TError
- type of exception it may raisepublic class SynchronizationPoint<TError extends Exception> extends Object implements ISynchronizationPoint<TError>, Future<Void>
Constructor and Description |
---|
SynchronizationPoint()
Constructor.
|
SynchronizationPoint(boolean unblocked)
Constructor with an initial state.
|
SynchronizationPoint(CancelException cancel)
Create an unblocked point with a cancellation.
|
SynchronizationPoint(TError error)
Create an unblocked point with an error.
|
Modifier and Type | Method and Description |
---|---|
void |
block(long timeout)
Pause the current thread to wait for this synchronization point to be unblocked.
|
void |
blockPause(long logAfter)
Really block, using wait method (used by threading system to know when a thread can be resumed).
|
boolean |
cancel(boolean mayInterruptIfRunning) |
void |
cancel(CancelException reason)
Cancel this synchronization point: unblock it immediately, and set the cancellation reason.
|
void |
error(TError error)
Unblock with an error.
|
Void |
get() |
Void |
get(long timeout,
TimeUnit unit) |
Collection<?> |
getAllListeners()
Return a collection with all listeners, only for debugging purposes.
|
CancelException |
getCancelEvent()
Get the reason of the cancellation.
|
TError |
getError()
Return the error.
|
boolean |
hasError()
Return true if unblocked because of an error.
|
boolean |
isCancelled()
Return true if unblocked because of a cancellation.
|
boolean |
isDone() |
boolean |
isUnblocked()
Return true if unblocked (success or cancelled).
|
void |
listenInline(Runnable r)
Call listener when unblocked (whatever the result is successful, has error or is cancelled).
|
void |
reset()
Reset this synchronization point to reuse it.
|
void |
restart()
Same as the method reset except that listeners are kept.
|
void |
unblock()
Unblock this synchronization point without error.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
blockException, blockThrow, forwardCancel, isSuccessful, listenAsync, listenAsync, listenAsyncSP, listenInline, listenInline, listenInline, listenInlineSP, listenInlineSP, onCancel, onError, onException, onSuccess, synchWithNoError, toAsyncWorkVoid
public SynchronizationPoint()
public SynchronizationPoint(boolean unblocked)
public SynchronizationPoint(TError error)
public SynchronizationPoint(CancelException cancel)
public Collection<?> getAllListeners()
ISynchronizationPoint
getAllListeners
in interface ISynchronizationPoint<TError extends Exception>
public void listenInline(Runnable r)
ISynchronizationPoint
listenInline
in interface ISynchronizationPoint<TError extends Exception>
public void unblock()
public void error(TError error)
ISynchronizationPoint
error
in interface ISynchronizationPoint<TError extends Exception>
public void cancel(CancelException reason)
ISynchronizationPoint
cancel
in interface ISynchronizationPoint<TError extends Exception>
public void block(long timeout)
ISynchronizationPoint
block
in interface ISynchronizationPoint<TError extends Exception>
public void blockPause(long logAfter)
ISynchronizationPoint
blockPause
in interface ISynchronizationPoint<TError extends Exception>
public boolean isUnblocked()
ISynchronizationPoint
isUnblocked
in interface ISynchronizationPoint<TError extends Exception>
public boolean isCancelled()
ISynchronizationPoint
isCancelled
in interface Future<Void>
isCancelled
in interface ISynchronizationPoint<TError extends Exception>
public boolean hasError()
ISynchronizationPoint
hasError
in interface ISynchronizationPoint<TError extends Exception>
public CancelException getCancelEvent()
ISynchronizationPoint
getCancelEvent
in interface ISynchronizationPoint<TError extends Exception>
public TError getError()
ISynchronizationPoint
getError
in interface ISynchronizationPoint<TError extends Exception>
public void reset()
public void restart()
public Void get() throws InterruptedException, ExecutionException
get
in interface Future<Void>
InterruptedException
ExecutionException
public Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<Void>
InterruptedException
ExecutionException
TimeoutException
public boolean cancel(boolean mayInterruptIfRunning)
Copyright © 2018. All rights reserved.