Interface IFlowControllerMediator
- All Known Implementing Classes:
FlowControllerMediator
public interface IFlowControllerMediator
- Author:
- Silvan Wyss
-
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.
-
Method Details
-
asLongAs
- Parameters:
condition-- Returns:
- a new
IAsLongAsMediatorwith the given condition. - Throws:
RuntimeException- if the given condition is null.
-
asSoonAs
- Parameters:
condition-- Returns:
- a new
IAsSoonAsMediatorwith the given condition. - Throws:
RuntimeException- if the given condition is null.
-
asSoonAsNoMore
- Parameters:
condition-- Returns:
- a new
IAsSoonAsMediatorwith the negation of the given condition. - Throws:
RuntimeException- if the given condition is null.
-
enqueue
Enqueues the given job.- Parameters:
job-- Returns:
- a
IFuturefor the given job. - Throws:
RuntimeException- if the given job is null.
-
forCount
- Parameters:
maxRunCount-- Returns:
- a new
IForCountMediatorwith the given maxRunCount. - Throws:
RuntimeException- if the given maxRunCount is negative.
-
forMaxMilliseconds
- Parameters:
maxDurationInMilliseconds-- Returns:
- a new
IForMaxMillisecondsMediatorfor the given maxDurationInMilliseconds. - Throws:
RuntimeException- if the given maxDurationInMilliseconds is negative.
-
forMaxSeconds
- Parameters:
maxDurationInSeconds-- Returns:
- a new
IForMaxMillisecondsMediatorfor the given maxDurationInSeconds. - Throws:
RuntimeException- if the given maxDurationInSeconds is negative.
-
runInBackground
Runs the given job in background.- Parameters:
job-- Returns:
- a new
IFuturefor the execution of the given job. - Throws:
RuntimeException- if the given job is null.
-
runInBackground
Runs the given resultJob in background. A result job is a job that returns a result.- 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. - Throws:
RuntimeException- if the given resultJob is null.
-
until
- Parameters:
condition-- Returns:
- a new
IAsLongAsMediatorfor the negation of the given condition. - Throws:
RuntimeException- if the given condition is null.
-
waitAsLongAs
Waits as long as the given condition is fulfilled.- Parameters:
condition-- Throws:
RuntimeException- if the given condition is null.
-
waitForMilliseconds
void waitForMilliseconds(int durationInMilliseconds) Waits for the given durationInMilliseconds.- Parameters:
durationInMilliseconds-- Throws:
RuntimeException- if the given durationInMilliseconds is negative.
-
waitForSeconds
void waitForSeconds(int durationInSeconds) Waits for the given durationInSeconds.- Parameters:
durationInSeconds-- Throws:
RuntimeException- if the given durationInSeconds is negative.
-
waitUntil
Waits until the given condition is fulfilled.- Parameters:
condition-- Throws:
RuntimeException- if the given condition is null.
-