|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ilog.mt.IlSynchronizationStrategy
Synchronization strategy base class. The name strategy refers to the strategy design pattern. Here, it enables concurrent access to shared resources using alternative synchronization schemes. Two standard implementations of this class are provided:
- IlSwingThreadSyncStrategy
for
Swing-based applications
- IlSynchronizeOnLockStrategy
to
synchronize on a mutex
This class also provides a default synchronization strategy. This default strategy can be changed by using the SetDefault function, or by using the ilog.mt.IlSynchronization.Strategy.Default system property. For example, to use IlSynchronizOnLockStrategy, launch your java application with the command: java -Dilog.mt.IlSynchronization.Strategy.Default=ilog.mt.IlSynchronizOnLockStrategy Aprogram
If no default property is set when GetDefault is first called, then the IlSwingThreadSyncStrategy class will be loaded and used as the default strategy.
Field Summary | |
protected static boolean |
_DefaultAlreadyInitialized
|
protected static IlSynchronizationStrategy |
_DefaultStrategy
Excluded. |
static String |
DEFAULT_PROPERTY
|
Constructor Summary | |
IlSynchronizationStrategy()
|
Method Summary | |
static IlSynchronizationStrategy |
GetDefault()
Gets the default strategy to use See the description of the class for more details |
boolean |
readLock(Runnable runnable,
Object lock)
Acquires a read lock for the current thread and calls run on the Runnable object passed. |
static void |
SetDefault(IlSynchronizationStrategy defaultStrategy)
Change the default strategy to use. |
abstract boolean |
synchronizeRun(Runnable runnable,
Object locker)
Synchronizes the current thread and calls run on the Runnable object passed. |
boolean |
writeLock(Runnable runnable,
Object lock)
Acquires a write lock for the current thread and calls run on the Runnable object passed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String DEFAULT_PROPERTY
protected static IlSynchronizationStrategy _DefaultStrategy
protected static boolean _DefaultAlreadyInitialized
Constructor Detail |
public IlSynchronizationStrategy()
Method Detail |
public static void SetDefault(IlSynchronizationStrategy defaultStrategy)
defaultStrategy
- The new default strategypublic static IlSynchronizationStrategy GetDefault()
public abstract boolean synchronizeRun(Runnable runnable, Object locker)
Runnable
object passed. Depending on the implementation of
the strategy, the synchronization may be global (such as in a Swing
application) or may use the object passed as the lock
parameter to synchronize on.runnable
- The Runnable
object on which the run
method will be calledlock
- This object may be used as the object to synchronize onpublic boolean readLock(Runnable runnable, Object lock)
Runnable
object passed. Some implementations may not
support read/write locks. For this reason, the default implementation
will call the synchronizeRun
method.runnable
- The Runnable
object on which the run
method will be calledlock
- This object may be used as the object to synchronize onpublic boolean writeLock(Runnable runnable, Object lock)
Runnable
object passed. Some implementations may not
support read/write locks. For this reason, the default implementation
will call the synchronizeRun
method.runnable
- The Runnable
object on which the run
method will be calledlock
- This object may be used as the object to synchronize on
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |