Package cz.xtf.core.waiting
Interface Waiter
-
- All Known Implementing Classes:
SimpleWaiter,SupplierWaiter
public interface WaiterAn object that waits on condition to be met.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classWaiter.LogPointObject for configurable conditional logging of waiting.
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_INTERVAL
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default WaiterfailFast(FailFastCheck failFast)Sets waiters fail fast function that indicates (returns true) if there is an error state and waiting should not proceed.Waiterinterval(long millis)Sets waiter conditions check interval.Waiterinterval(TimeUnit timeUnit, long t)Sets waiter conditions check interval.default Waiterlevel(org.slf4j.event.Level level)Set the level of severity for a log message.WaiterlogPoint(Waiter.LogPoint logPoint)Sets waiters logPoints.default WaiteronFailure(Runnable runnable)Sets waiters failed awaiting execution.default WaiteronIteration(Runnable runnable)Sets waiters execution for each iteration.default WaiteronSuccess(Runnable runnable)Sets waiters successful awaiting execution.default WaiteronTimeout(Runnable runnable)Sets waiters timed out awaiting execution.Waiterreason(String reason)Sets waiting reason.Waitertimeout(long millis)Sets waiter timeout after which waiters stops waiting.Waitertimeout(TimeUnit timeUnit, long t)Sets waiter timeout after which waiters stops waiting.booleanwaitFor()Waits till condition is met.
-
-
-
Field Detail
-
DEFAULT_INTERVAL
static final long DEFAULT_INTERVAL
- See Also:
- Constant Field Values
-
-
Method Detail
-
timeout
Waiter timeout(long millis)
Sets waiter timeout after which waiters stops waiting. Timeout is logged in case of settinglogPoint(LogPoint)to anything else thenWaiter.LogPoint.NONE- Parameters:
millis- timeout in milliseconds- Returns:
- this
-
timeout
Waiter timeout(TimeUnit timeUnit, long t)
Sets waiter timeout after which waiters stops waiting. Timeout is logged in case of settinglogPoint(LogPoint)to anything else thenWaiter.LogPoint.NONE- Parameters:
timeUnit- timeUnit that is converts timetto millisecondst- timeout intimeUnit- Returns:
- this
-
interval
Waiter interval(long millis)
Sets waiter conditions check interval.- Parameters:
millis- interval in milliseconds- Returns:
- this
-
interval
Waiter interval(TimeUnit timeUnit, long t)
Sets waiter conditions check interval.- Parameters:
timeUnit- timeUnit that is converts timetto millisecondst- interval in milliseconds- Returns:
- this
-
reason
Waiter reason(String reason)
Sets waiting reason.- Parameters:
reason- what the waiters what upon.- Returns:
- this
-
logPoint
Waiter logPoint(Waiter.LogPoint logPoint)
Sets waiters logPoints.- Parameters:
logPoint- what points of waiting should be logged.- Returns:
- this
- See Also:
Waiter.LogPoint
-
level
default Waiter level(org.slf4j.event.Level level)
Set the level of severity for a log message.- Parameters:
level- what level of severity should be used to log the message.- Returns:
- this
- See Also:
Level
-
onIteration
default Waiter onIteration(Runnable runnable)
Sets waiters execution for each iteration.- Parameters:
runnable- code to be executed upon successful waiting.- Returns:
- this
-
onSuccess
default Waiter onSuccess(Runnable runnable)
Sets waiters successful awaiting execution.- Parameters:
runnable- code to be executed upon successful waiting.- Returns:
- this
-
onFailure
default Waiter onFailure(Runnable runnable)
Sets waiters failed awaiting execution.- Parameters:
runnable- code to be executed upon failed waiting.- Returns:
- this
-
onTimeout
default Waiter onTimeout(Runnable runnable)
Sets waiters timed out awaiting execution.- Parameters:
runnable- code to be executed upon timed out waiting.- Returns:
- this
-
failFast
default Waiter failFast(FailFastCheck failFast)
Sets waiters fail fast function that indicates (returns true) if there is an error state and waiting should not proceed.- Parameters:
failFast- returns true if waiting has failed.- Returns:
- this
-
waitFor
boolean waitFor()
Waits till condition is met.- Returns:
- true if wanted condition was met, false if unwanted state condition was met
- Throws:
WaiterException- in case of timeout
-
-