Package org.jgroups.blocks.executor
Class ExecutionService.DistributedFuture.Sync<V>
- java.lang.Object
-
- java.util.concurrent.locks.AbstractOwnableSynchronizer
-
- java.util.concurrent.locks.AbstractQueuedSynchronizer
-
- org.jgroups.blocks.executor.ExecutionService.DistributedFuture.Sync<V>
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- ExecutionService.DistributedFuture<V>
protected static final class ExecutionService.DistributedFuture.Sync<V> extends java.util.concurrent.locks.AbstractQueuedSynchronizerSynchronization control for FutureTask. Note that this must be a non-static inner class in order to invoke the protected done method. For clarity, all inner class support methods are same as outer, prefixed with "inner". Uses AQS sync state to represent run status- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.Callable<V>callableThe underlying callableprotected static intCANCELLEDState value representing that task was cancelledprotected java.lang.ThrowableexceptionThe exception to throw from get()protected ExecutionService.DistributedFuture<V>futureThe containing futureprotected static intRANState value representing that task ranprotected VresultThe result to return from get()protected java.lang.ThreadrunnerThe thread running task.protected static intRUNNINGState value representing that task is running
-
Constructor Summary
Constructors Constructor Description Sync(ExecutionService.DistributedFuture<V> future, java.util.concurrent.Callable<V> callable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected inttryAcquireShared(int ignore)Implements AQS base acquire to succeed if ran or cancelledprotected booleantryReleaseShared(int ignore)Implements AQS base release to always signal after setting final done status by nulling runner thread.-
Methods inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
acquire, acquireInterruptibly, acquireShared, acquireSharedInterruptibly, compareAndSetState, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedPredecessors, hasQueuedThreads, hasWaiters, isHeldExclusively, isQueued, owns, release, releaseShared, setState, toString, tryAcquire, tryAcquireNanos, tryAcquireSharedNanos, tryRelease
-
-
-
-
Field Detail
-
RUNNING
protected static final int RUNNING
State value representing that task is running- See Also:
- Constant Field Values
-
RAN
protected static final int RAN
State value representing that task ran- See Also:
- Constant Field Values
-
CANCELLED
protected static final int CANCELLED
State value representing that task was cancelled- See Also:
- Constant Field Values
-
future
protected final ExecutionService.DistributedFuture<V> future
The containing future
-
callable
protected final java.util.concurrent.Callable<V> callable
The underlying callable
-
result
protected V result
The result to return from get()
-
exception
protected java.lang.Throwable exception
The exception to throw from get()
-
runner
protected transient volatile java.lang.Thread runner
The thread running task. When nulled after set/cancel, this indicates that the results are accessible. Must be volatile, to ensure visibility upon completion.
-
-
Constructor Detail
-
Sync
public Sync(ExecutionService.DistributedFuture<V> future, java.util.concurrent.Callable<V> callable)
-
-
Method Detail
-
tryAcquireShared
protected int tryAcquireShared(int ignore)
Implements AQS base acquire to succeed if ran or cancelled- Overrides:
tryAcquireSharedin classjava.util.concurrent.locks.AbstractQueuedSynchronizer
-
tryReleaseShared
protected boolean tryReleaseShared(int ignore)
Implements AQS base release to always signal after setting final done status by nulling runner thread.- Overrides:
tryReleaseSharedin classjava.util.concurrent.locks.AbstractQueuedSynchronizer
-
-