Class AbstractAsyncHandlerProvider
java.lang.Object
com.gigaspaces.internal.utils.concurrent.AbstractAsyncHandlerProvider
- All Implemented Interfaces:
IAsyncHandlerProvider
- Direct Known Subclasses:
ScheduledThreadPoolAsyncHandlerProvider,SharedHandlerProviderCache.SharedAsyncHandlerProviderWrapper,ThreadAsyncHandlerProvider
- Since:
- 9.0.1
- Author:
- eitany
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNested classes/interfaces inherited from interface com.gigaspaces.internal.utils.concurrent.IAsyncHandlerProvider
IAsyncHandlerProvider.CycleResult -
Field Summary
Fields -
Constructor Summary
Constructors -
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 closedprotected abstract voidonClose()voidRemoves the specified state listenerstart(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) Start executing a runnable in a repetitive manner.protected abstract IAsyncHandlerstartImpl(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) 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.protected abstract IAsyncHandlerstartMayBlockImpl(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart)
-
Field Details
-
_stateLock
-
-
Constructor Details
-
AbstractAsyncHandlerProvider
public AbstractAsyncHandlerProvider()
-
-
Method Details
-
start
public IAsyncHandler start(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) Description copied from interface:IAsyncHandlerProviderStart executing a runnable in a repetitive manner.- Specified by:
startin interfaceIAsyncHandlerProvider- 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().
-
startImpl
protected abstract IAsyncHandler startImpl(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) -
startMayBlock
public IAsyncHandler startMayBlock(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) Description copied from interface:IAsyncHandlerProviderStart 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- Specified by:
startMayBlockin interfaceIAsyncHandlerProvider- 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().
-
startMayBlockImpl
protected abstract IAsyncHandler startMayBlockImpl(AsyncCallable callable, long idleDelayMilis, String name, boolean waitIdleDelayBeforeStart) -
close
public void close()Description copied from interface:IAsyncHandlerProviderClose the async handler provider- Specified by:
closein interfaceIAsyncHandlerProvider
-
onClose
protected abstract void onClose() -
isClosed
public boolean isClosed()Description copied from interface:IAsyncHandlerProviderSpecifies is this async handler provider is already closed- Specified by:
isClosedin interfaceIAsyncHandlerProvider
-
addStateListener
Description copied from interface:IAsyncHandlerProviderAdds a state listener to be notified on this provider state changes events- Specified by:
addStateListenerin interfaceIAsyncHandlerProvider- Returns:
- false if this provider is already closed
-
removeStateListener
Description copied from interface:IAsyncHandlerProviderRemoves the specified state listener- Specified by:
removeStateListenerin interfaceIAsyncHandlerProvider
-