Class AbstractRunnable
- java.lang.Object
-
- org.elasticsearch.common.util.concurrent.AbstractRunnable
-
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
AbstractLifecycleRunnable,ActionRunnable,Scheduler.ReschedulingRunnable
public abstract class AbstractRunnable extends Object implements Runnable
An extension to runnable.
-
-
Constructor Summary
Constructors Constructor Description AbstractRunnable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoRun()This method has the same semantics asRunnable.run()booleanisForceExecution()Should the runnable force its execution in case it gets rejected?voidonAfter()This method is called in a finally block after successful execution or on a rejection.abstract voidonFailure(Exception e)This method is invoked for all exception thrown bydoRun()voidonRejection(Exception e)This should be executed if the thread-pool executing this action rejected the execution.voidrun()
-
-
-
Method Detail
-
isForceExecution
public boolean isForceExecution()
Should the runnable force its execution in case it gets rejected?
-
onAfter
public void onAfter()
This method is called in a finally block after successful execution or on a rejection.
-
onFailure
public abstract void onFailure(Exception e)
This method is invoked for all exception thrown bydoRun()
-
onRejection
public void onRejection(Exception e)
This should be executed if the thread-pool executing this action rejected the execution. The default implementation forwards toonFailure(Exception)
-
doRun
protected abstract void doRun() throws ExceptionThis method has the same semantics asRunnable.run()- Throws:
InterruptedException- if the run method throws an InterruptedExceptionException
-
-