public abstract class AsynchronousExecution extends RuntimeException
Executor). May be thrown from
Executable#runafter doing any preparatory work synchronously.
Executor.isActive() will remain true (even though
Thread.isAlive() is not) until
completed(java.lang.Throwable) is called.
The thrower will need to hold on to a reference to this instance as a handle to call
The execution may not extend into another Jenkins session; if you wish to model a long-running execution, you must schedule a new task after restart. This class is not serializable anyway.
Mainly intended for use with
OneOffExecutor (from a
Queue.FlyweightTask), of which there could be many,
but could also be used with a heavyweight executor even though the number of executors is bounded by node configuration.
|Modifier||Constructor and Description|
Constructor for subclasses.
|Modifier and Type||Method and Description|
Allows an executable to indicate whether it is currently doing something which should prevent Jenkins from being shut down safely.
To be called when the task is actually complete.
Allows an executable to control whether or not to display
Obtains the associated executor.
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public abstract void interrupt(boolean forShutdown)
Executor.interrupt()and its overloads. As with the standard Java method, you are requested to cease work as soon as possible, but there is no enforcement of this. You might also want to call
Executor.recordCauseOfInterruption(hudson.model.Run<?, ?>, hudson.model.TaskListener)on
forShutdown- if true, this interruption is because Jenkins is shutting down (and thus
Computer#interruptwas called from
Jenkins#cleanUp); otherwise, a normal interrupt such as by
public abstract boolean blocksRestart()
interrupt(boolean)will be passed
public abstract boolean displayCell()
If this method returns false, the asynchronous execution becomes invisible from UI.
@CheckForNull public final Executor getExecutor()
setExecutor(hudson.model.Executor)has not been called yet.
public final void completed(@CheckForNull Throwable error)
error- normally null (preferable to handle errors yourself), but may be specified to simulate an exception from
Executable#run, as per
Copyright © 2004–2017. All rights reserved.