Class FlowControllerMediator
java.lang.Object
ch.nolix.base.programcontrol.flowcontrol.FlowControllerMediator
- All Implemented Interfaces:
IFlowControllerMediator
- Author:
- Silvan Wyss
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasLongAs(BooleanSupplier condition) asSoonAs(BooleanSupplier condition) asSoonAsNoMore(BooleanSupplier condition) Enqueues the given job.forCount(int maxRunCount) forMaxMilliseconds(int maxDurationInMilliseconds) forMaxSeconds(int maxDurationInSeconds) runInBackground(Runnable job) Runs the given job in background.<R> IResultFuture<R> runInBackground(Supplier<R> resultJob) Runs the given resultJob in background.until(BooleanSupplier condition) voidwaitAsLongAs(BooleanSupplier condition) Waits as long as the given condition is fulfilled.voidwaitForMilliseconds(int durationInMilliseconds) Waits for the given durationInMilliseconds.voidwaitForSeconds(int durationInSeconds) Waits for the given durationInSeconds.voidwaitUntil(BooleanSupplier condition) Waits until the given condition is fulfilled.
-
Constructor Details
-
FlowControllerMediator
public FlowControllerMediator()
-
-
Method Details
-
asLongAs
- Specified by:
asLongAsin interfaceIFlowControllerMediator- Parameters:
condition-- Returns:
- a new
IAsLongAsMediatorwith the given condition.
-
asSoonAs
- Specified by:
asSoonAsin interfaceIFlowControllerMediator- Parameters:
condition-- Returns:
- a new
IAsSoonAsMediatorwith the given condition.
-
asSoonAsNoMore
- Specified by:
asSoonAsNoMorein interfaceIFlowControllerMediator- Parameters:
condition-- Returns:
- a new
IAsSoonAsMediatorwith the negation of the given condition.
-
enqueue
Enqueues the given job.- Specified by:
enqueuein interfaceIFlowControllerMediator- Parameters:
job-- Returns:
- a
IFuturefor the given job.
-
forCount
- Specified by:
forCountin interfaceIFlowControllerMediator- Parameters:
maxRunCount-- Returns:
- a new
IForCountMediatorwith the given maxRunCount.
-
forMaxMilliseconds
- Specified by:
forMaxMillisecondsin interfaceIFlowControllerMediator- Parameters:
maxDurationInMilliseconds-- Returns:
- a new
IForMaxMillisecondsMediatorfor the given maxDurationInMilliseconds.
-
forMaxSeconds
- Specified by:
forMaxSecondsin interfaceIFlowControllerMediator- Parameters:
maxDurationInSeconds-- Returns:
- a new
IForMaxMillisecondsMediatorfor the given maxDurationInSeconds.
-
runInBackground
Runs the given job in background.- Specified by:
runInBackgroundin interfaceIFlowControllerMediator- Parameters:
job-- Returns:
- a new
IFuturefor the execution of the given job.
-
runInBackground
Runs the given resultJob in background. A result job is a job that returns a result.- Specified by:
runInBackgroundin interfaceIFlowControllerMediator- Type Parameters:
R- is the type of the result the given resultJob returns.- Parameters:
resultJob-- Returns:
- a new
IResultFuturefor the execution of the given resultJob.
-
until
- Specified by:
untilin interfaceIFlowControllerMediator- Parameters:
condition-- Returns:
- a new
IAsLongAsMediatorfor the negation of the given condition.
-
waitAsLongAs
Waits as long as the given condition is fulfilled.- Specified by:
waitAsLongAsin interfaceIFlowControllerMediator- Parameters:
condition-
-
waitForMilliseconds
public void waitForMilliseconds(int durationInMilliseconds) Waits for the given durationInMilliseconds.- Specified by:
waitForMillisecondsin interfaceIFlowControllerMediator- Parameters:
durationInMilliseconds-
-
waitForSeconds
public void waitForSeconds(int durationInSeconds) Waits for the given durationInSeconds.- Specified by:
waitForSecondsin interfaceIFlowControllerMediator- Parameters:
durationInSeconds-
-
waitUntil
Waits until the given condition is fulfilled.- Specified by:
waitUntilin interfaceIFlowControllerMediator- Parameters:
condition-
-