Module org.elasticsearch.xcore
Class CancellableRunnable<T>
java.lang.Object
org.elasticsearch.common.util.concurrent.AbstractRunnable
org.elasticsearch.xpack.core.security.support.CancellableRunnable<T>
- All Implemented Interfaces:
Runnable
A runnable that allows us to terminate and call the listener. We use this as a runnable can
be queued and not executed for a long time or ever and this causes user requests to appear
to hang. In these cases at least we can provide a response.
-
Constructor Summary
ConstructorsConstructorDescriptionCancellableRunnable(ActionListener<T> listener, Function<Exception, T> defaultValue, Runnable in, org.apache.logging.log4j.Logger logger) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoRun()voidIf the execution of this runnable has not already started, the runnable is cancelled and we pass an exception to the user listenervoidvoidMethods inherited from class org.elasticsearch.common.util.concurrent.AbstractRunnable
isForceExecution, onAfter, run
-
Constructor Details
-
CancellableRunnable
-
-
Method Details
-
onFailure
- Specified by:
onFailurein classAbstractRunnable
-
doRun
- Specified by:
doRunin classAbstractRunnable- Throws:
Exception
-
onRejection
- Overrides:
onRejectionin classAbstractRunnable
-
maybeTimeout
public void maybeTimeout()If the execution of this runnable has not already started, the runnable is cancelled and we pass an exception to the user listener
-