TError - type of exception it may raisepublic class JoinPoint<TError extends Exception> extends Async<TError>
| Constructor and Description |
|---|
JoinPoint()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToJoin(IAsync<?> sp,
Function<Exception,TError> errorConverter)
Register the given synchronization point as a waited event for this JoinPoint.
The number of waited events is incremented, and a listener is added to the synchronization point and do the following when the synchronization point is unblocked: Cancel this JoinPoint if the synchronization point is cancelled Unblock this JoinPoint with an error if the synchronization point has been unblocked with an error Call the joined method if the synchronization point has been unblocked with success |
void |
addToJoin(IAsync<? extends TError> sp)
Register the given synchronization point as a waited event for this JoinPoint.
The number of waited events is incremented, and a listener is added to the synchronization point and do the following when the synchronization point is unblocked: Cancel this JoinPoint if the synchronization point is cancelled Unblock this JoinPoint with an error if the synchronization point has been unblocked with an error Call the joined method if the synchronization point has been unblocked with success |
void |
addToJoin(int nb)
Specify that we are waiting for the given number of additional events.
|
void |
addToJoin(Task<?,? extends TError> task)
Register the given task as a waited event for this JoinPoint.
Equivalent to addToJoin(task.getSynch()) |
void |
addToJoinDoNotCancel(IAsync<? extends TError> sp)
Similar to addToJoin, but in case the synchronization point is cancelled,
it is simply consider as done, and do not cancel this JoinPoint.
|
void |
addToJoinNoException(IAsync<?> sp)
Register the given synchronization point as a waited event for this JoinPoint.
The number of waited events is incremented, and a listener is added to the synchronization point. |
static JoinPoint<Exception> |
from(Collection<? extends IAsync<?>> synchPoints)
Shortcut method to create a JoinPoint waiting for the given synchronization points, the JoinPoint is started by this method.
|
static JoinPoint<Exception> |
from(IAsync<?>... synchPoints)
Shortcut method to create a JoinPoint waiting for the given synchronization points, the JoinPoint is started by this method.
|
static <T extends Exception> |
fromSimilarError(IAsync<T>... synchPoints)
Shortcut method to create a JoinPoint waiting for the given synchronization points, the JoinPoint is started by this method.
If some given synchronization points are null, they are just skipped.
|
static JoinPoint<Exception> |
fromTasks(Collection<? extends Task<?,?>> tasks)
Shortcut method to create a JoinPoint waiting for the given tasks, the JoinPoint is started by this method.
If any task has error or is cancelled, the join point is immediately unblocked, even other tasks are still pending.
|
static JoinPoint<Exception> |
fromTasks(Task<?,?>... tasks)
Shortcut method to create a JoinPoint waiting for the given tasks, the JoinPoint is started by this method.
If any task has error or is cancelled, the join point is immediately unblocked, even other tasks are still pending.
|
static JoinPoint<NoException> |
fromTasksNoErrorOrCancel(Collection<? extends Task<?,?>> tasks)
Shortcut method to create a JoinPoint waiting for the given tasks, the JoinPoint is started by this method.
The JoinPoint is not unblocked until all tasks are done.
|
int |
getToJoin()
Return the number of remaining events this JoinPoint is waiting for.
|
void |
joined()
Method to be called to signal that an event is done.
The number of waited events is decremented, if it becomes 0 this JoinPoint is unblocked with success. |
static void |
joinOnDoneThenDo(Runnable listener,
IAsync<?>... synchPoints)
Shortcut method to create a JoinPoint waiting for the given synchronization points, start the JoinPoint,
and add the given listener to be called when the JoinPoint is unblocked.
|
static void |
joinThenDo(Runnable listener,
IAsync<?>... synchPoints)
Shortcut method to create a JoinPoint waiting for the given synchronization points, start the JoinPoint,
and add the given listener to be called when the JoinPoint is unblocked.
|
void |
listenTime(long timeout,
Runnable callback)
Call the given callback if this JoinPoint is still not yet unblocked after the given number of milliseconds.
|
void |
start()
Start this JoinPoint, so as soon as the number of waited events becomes zero, this JoinPoint becomes unblocked.
|
void |
timeout(long millis,
Runnable callback)
Should be used only for debugging purpose, as a JoinPoint is supposed to always become unblocked.
This method will wait for the given milliseconds, if at this time the JoinPoint is already unblocked, nothing is done, else we force it to become unblocked, and the given callback is called if any. |
block, blockPauseCondition, cancel, cancel, error, get, get, getAllListeners, getCancelEvent, getError, hasError, isCancelled, isDone, onDone, reset, restart, unblockclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitblockException, blockPause, blockThrow, forwardIfNotSuccessful, isSuccessful, logListenerError, onCancel, onDone, onDone, onDone, onDone, onDone, onDone, onError, onErrorOrCancel, onSuccess, thenDoOrStart, thenDoOrStart, thenDoOrStart, thenStart, thenStart, thenStart, thenStart, thenStart, thenStart, toAsyncSupplierpublic int getToJoin()
public void addToJoin(int nb)
public void addToJoin(IAsync<? extends TError> sp)
public void addToJoin(IAsync<?> sp, Function<Exception,TError> errorConverter)
public void addToJoin(Task<?,? extends TError> task)
public void addToJoinNoException(IAsync<?> sp)
public void addToJoinDoNotCancel(IAsync<? extends TError> sp)
public void start()
public void joined()
public void timeout(long millis,
Runnable callback)
public void listenTime(long timeout,
Runnable callback)
public static JoinPoint<Exception> from(IAsync<?>... synchPoints)
public static JoinPoint<Exception> from(Collection<? extends IAsync<?>> synchPoints)
@SafeVarargs public static <T extends Exception> JoinPoint<T> fromSimilarError(IAsync<T>... synchPoints)
public static JoinPoint<Exception> fromTasks(Task<?,?>... tasks)
public static JoinPoint<Exception> fromTasks(Collection<? extends Task<?,?>> tasks)
public static JoinPoint<NoException> fromTasksNoErrorOrCancel(Collection<? extends Task<?,?>> tasks)
public static void joinThenDo(Runnable listener, IAsync<?>... synchPoints)
public static void joinOnDoneThenDo(Runnable listener, IAsync<?>... synchPoints)
Copyright © 2019. All rights reserved.