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