Class ExecutionService.DistributedFuture.Sync<V>

All Implemented Interfaces:
Serializable
Enclosing class:
ExecutionService.DistributedFuture<V>

protected static final class ExecutionService.DistributedFuture.Sync<V> extends AbstractQueuedSynchronizer
Synchronization 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:
  • Field Details

    • RUNNING

      protected static final int RUNNING
      State value representing that task is running
      See Also:
    • RAN

      protected static final int RAN
      State value representing that task ran
      See Also:
    • CANCELLED

      protected static final int CANCELLED
      State value representing that task was cancelled
      See Also:
    • future

      protected final ExecutionService.DistributedFuture<V> future
      The containing future
    • callable

      protected final Callable<V> callable
      The underlying callable
    • result

      protected V result
      The result to return from get()
    • exception

      protected Throwable exception
      The exception to throw from get()
    • runner

      protected transient volatile 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 Details

  • Method Details

    • tryAcquireShared

      protected int tryAcquireShared(int ignore)
      Implements AQS base acquire to succeed if ran or cancelled
      Overrides:
      tryAcquireShared in class AbstractQueuedSynchronizer
    • tryReleaseShared

      protected boolean tryReleaseShared(int ignore)
      Implements AQS base release to always signal after setting final done status by nulling runner thread.
      Overrides:
      tryReleaseShared in class AbstractQueuedSynchronizer