Class AbstractRunnable
- java.lang.Object
-
- org.elasticsearch.common.util.concurrent.AbstractRunnable
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
AbstractLifecycleRunnable,ActionRunnable,Scheduler.ReschedulingRunnable
public abstract class AbstractRunnable extends java.lang.Object implements java.lang.RunnableAn extension to runnable.
-
-
Constructor Summary
Constructors Constructor Description AbstractRunnable()
-
Method Summary
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(java.lang.Exception e)This method is invoked for all exception thrown bydoRun()voidonRejection(java.lang.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?
-
run
public final void run()
- Specified by:
runin interfacejava.lang.Runnable
-
onAfter
public void onAfter()
This method is called in a finally block after successful execution or on a rejection.
-
onFailure
public abstract void onFailure(java.lang.Exception e)
This method is invoked for all exception thrown bydoRun()
-
onRejection
public void onRejection(java.lang.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 java.lang.ExceptionThis method has the same semantics asRunnable.run()- Throws:
java.lang.InterruptedException- if the run method throws an InterruptedExceptionjava.lang.Exception
-
-