1 /*******************************************************************************
2 * Copyright (c) 2013 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 * Semantum Oy - initial API and implementation
12 *******************************************************************************/
13 package org.simantics.simulator.variable;
16 * Realm controls access to some local resource.
18 * @author Hannu Niemistö
19 * @author Antti Villberg
21 public interface Realm {
24 * Executes the given runnable in this realm synchronously so that the method
25 * returns only after the runnable has finished. Can be called only when not
26 * inside the realm. Calling the method in the realm either causes
27 * a deadlock or {@link IllegalStateException}.
28 * @throws InterruptedException
30 void syncExec(Runnable runnable) throws InterruptedException;
33 * Executes the runnable in this realm asynchronously.
34 * This method can be called freely inside or outside of the realm.
35 * When executed inside the realm it is guaranteed that no
36 * internal event (for example a simulator step) is taken before
37 * executing the runnable.
39 void asyncExec(Runnable runnable);