Class ThreadAsyncHandlerProvider.AsyncRunnableWrapper
java.lang.Object
com.gigaspaces.internal.utils.concurrent.ThreadAsyncHandlerProvider.AsyncRunnableWrapper
- All Implemented Interfaces:
IAsyncHandler,Runnable
- Enclosing class:
- ThreadAsyncHandlerProvider
public static class ThreadAsyncHandlerProvider.AsyncRunnableWrapper
extends Object
implements Runnable, IAsyncHandler
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncRunnableWrapper(ThreadAsyncHandlerProvider provider, Callable<IAsyncHandlerProvider.CycleResult> runnable, long idleDelayMilis, boolean waitIdleDelayBeforeStart) -
Method Summary
Modifier and TypeMethodDescriptiongetName()booleanSpecifies whether this async handler is terminated and will not run againvoidresume()Resume the life cycle of the handler if it is in suspended mode, the next execution will be scheduled according to the idle delay timeout the handler was created withvoidResume the life cycle of the handler if it is in suspended mode, the next execution will start immediately.voidrun()voidvoidStop the execution of this async handler.voidwakeUp()Wakes up the handler if in idle state and execute a cycle of the runnablebooleanwakeUpAndWait(long timeout, TimeUnit units) Wakes up the handler if in idle or suspended state and wait for it complete one cycle.
-
Constructor Details
-
AsyncRunnableWrapper
public AsyncRunnableWrapper(ThreadAsyncHandlerProvider provider, Callable<IAsyncHandlerProvider.CycleResult> runnable, long idleDelayMilis, boolean waitIdleDelayBeforeStart)
-
-
Method Details
-
setThread
-
run
public void run() -
wakeUp
public void wakeUp()Description copied from interface:IAsyncHandlerWakes up the handler if in idle state and execute a cycle of the runnable- Specified by:
wakeUpin interfaceIAsyncHandler
-
wakeUpAndWait
Description copied from interface:IAsyncHandlerWakes up the handler if in idle or suspended state and wait for it complete one cycle. Will wait for the specified timeout until one cycle is completed and returns true if the cycle was completed during that timeout, otherwise false.- Specified by:
wakeUpAndWaitin interfaceIAsyncHandler
-
stop
Description copied from interface:IAsyncHandlerStop the execution of this async handler. Will wait for the specified timeout until the handler is stopped which guarantees no following execution of the wrapped runnable. If the timeout elapsed this method returns but there might be an ongoing execution which was not stopped yet. However that will be no new execution after this method returns- Specified by:
stopin interfaceIAsyncHandler
-
resume
public void resume()Description copied from interface:IAsyncHandlerResume the life cycle of the handler if it is in suspended mode, the next execution will be scheduled according to the idle delay timeout the handler was created with- Specified by:
resumein interfaceIAsyncHandler
-
resumeNow
public void resumeNow()Description copied from interface:IAsyncHandlerResume the life cycle of the handler if it is in suspended mode, the next execution will start immediately.- Specified by:
resumeNowin interfaceIAsyncHandler
-
isTerminated
public boolean isTerminated()Description copied from interface:IAsyncHandlerSpecifies whether this async handler is terminated and will not run again- Specified by:
isTerminatedin interfaceIAsyncHandler
-
getName
- Specified by:
getNamein interfaceIAsyncHandler
-