Converted all CRLF to LF.
[indepmod/experimental.git] / IndependentModeler / src / cz / cvut / promod / services / Service.java
blobf5e4a3684d83d2c07acccf945dfb17895e872ebc
1 package cz.cvut.promod.services;
3 /**
4 * ProMod, master thesis project
5 * User: Petr Zverina, petr.zverina@gmail.com
6 * Date: 16:20:15, 10.10.2009
7 */
9 /**
10 * Common interface for all services.
12 * IMPORTANT NOTE! All services and their methods are supposed NOT to be used in (or by) a different thread
13 * that Event Dispatcher Thread or Main Thread (during application start - init() method of any plugin).
14 * Even all resources provided by services (generally ModelerSession), e.g. all instances of a ValueModel
15 * interface etc., are supposed to be used only in Event Dispatcher Thread or Main Thread (during application start).
17 * One can use following code fragment if is not convinced about the thread identity:
19 * if(SwingUtilities.isEventDispatchThread()){
20 * usage of a service or a it's resource
21 * }
23 * One can always delegate any program sequence to the Event Dispatcher thread too. Use:
24 * 1) SwingUtilities.invokeAndWait(Runnable doRun) or
25 * 2) SwingUtilities.invokeLater(Runnable doRun) - generally preferable solution.
27 * Usage of services and their resources form another thread than Event Dispatcher Thread can cause a
28 * unpredictable inconsistency of application. One is supposed to always avoid using services and their
29 * resources out of the Event Dispatcher Thread!
31 * @see cz.cvut.promod.services.ModelerSession
32 * @see javax.swing.SwingUtilities
34 public interface Service {
36 /**
37 * Is the common method for all services and is invoked by the IndependentModelerMain class
38 * @see cz.cvut.promod.IndependentModelerMain
40 * This method is invoked during ProMod start to check availability and integrity of services.
42 * @return true if no error has occurred during check, false otherwise
44 public boolean check();