|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.domian.util.concurrent.locks.SemaphoreSynchronizer
public final class SemaphoreSynchronizer
A Synchronizer implementation using two Semaphore instances.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface net.sourceforge.domian.util.concurrent.locks.Synchronizer |
|---|
Synchronizer.MODE |
| Constructor Summary | |
|---|---|
SemaphoreSynchronizer()
|
|
| Method Summary | ||
|---|---|---|
|
callConcurrently(C callable)
Calls a Callable in a concurrent manner. |
|
|
callExclusively(C callable)
Calls a Callable in an exclusive manner. |
|
|
runConcurrently(R runnable)
Runs a Runnable in a concurrent manner. |
|
|
runExclusively(R runnable)
Runs a Runnable in an exclusive manner. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SemaphoreSynchronizer()
| Method Detail |
|---|
public <R extends java.lang.Runnable> void runConcurrently(R runnable)
SynchronizerRunnable in a concurrent manner.
runConcurrently in interface Synchronizerrunnable - the runnable to invoke concurrently, managed by this classpublic <T,C extends java.util.concurrent.Callable<T>> T callConcurrently(C callable)
SynchronizerCallable in a concurrent manner.
callConcurrently in interface Synchronizercallable - the callable to invoke concurrently, managed by this class
Callable's return value, or null if no return valuepublic <R extends java.lang.Runnable> void runExclusively(R runnable)
SynchronizerRunnable in an exclusive manner.
Firstly, it will wait for all other exclusive Runnables and Callables to finish, if any.
Then it will wait for already running concurrent Runnables and Callables to finish, if any.
Finally it will run, queuing up all other Runnables and Callables managed by the same Synchronizer instance.
When done, all queues are released.
runExclusively in interface Synchronizerrunnable - the runnable to invoke exclusively, managed by this classpublic <T,C extends java.util.concurrent.Callable<T>> T callExclusively(C callable)
SynchronizerCallable in an exclusive manner.
Firstly, it will wait for all other exclusive Runnables and Callables to finish, if any.
Then it will wait for already running concurrent Runnables and Callables to finish, if any.
Finally it will run, queuing up all other Runnables and Callables managed by the same Synchronizer instance.
When done, all queues are released.
callExclusively in interface Synchronizercallable - the callable to invoke exclusively, managed by this class
Callable's return value, or null if no return value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||