Interface IAsyncHandlerProvider
- All Known Implementing Classes:
AbstractAsyncHandlerProvider,ScheduledThreadPoolAsyncHandlerProvider,SharedHandlerProviderCache.SharedAsyncHandlerProviderWrapper,ThreadAsyncHandlerProvider
public interface IAsyncHandlerProvider
Provides
IAsyncHandler for repetitive execution of runnables- Since:
- 8.0
- Author:
- eitany
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a state listener to be notified on this provider state changes eventsvoidclose()Close the async handler providerbooleanisClosed()Specifies is this async handler provider is already closedvoidRemoves the specified state listenerstart(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) Start executing a runnable in a repetitive manner.startMayBlock(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) Start executing a runnable in a repetitive manner, the task may block during its process so the provider must be able to support this.
-
Method Details
-
start
IAsyncHandler start(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) Start executing a runnable in a repetitive manner.- Parameters:
callable- the runnable to execute at each iterationidleDelayMilis- the delay between each iteration when the runnable returned aIAsyncHandlerProvider.CycleResult.IDLE_CONTINUEname- hint name for the async handler if supportedwaitIdleDelayBeforeStart- should the task run for the first time only after idleDelayMillis- Returns:
- async handler that allows interaction with the repetitive execution of the runnable
If this method is executed after the provider is a closed, the result handler will be terminated on execution IAsyncHandler.isTerminated().
-
startMayBlock
IAsyncHandler startMayBlock(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) Start executing a runnable in a repetitive manner, the task may block during its process so the provider must be able to support this. in terms of thread pool limitations- Parameters:
callable- the runnable to execute at each iterationidleDelayMilis- the delay between each iteration when the runnable returned aIAsyncHandlerProvider.CycleResult.IDLE_CONTINUEname- hint name for the async handler if supportedwaitIdleDelayBeforeStart- should the task run for the first time only after idleDelayMillis- Returns:
- async handler that allows interaction with the repetitive execution of the runnable
If this method is executed after the provider is a closed, the result handler will be terminated on execution IAsyncHandler.isTerminated().
-
close
void close()Close the async handler provider -
isClosed
boolean isClosed()Specifies is this async handler provider is already closed -
addStateListener
Adds a state listener to be notified on this provider state changes events- Returns:
- false if this provider is already closed
-
removeStateListener
Removes the specified state listener
-