Package jenkins.tasks
Class SimpleBuildWrapper.Disposer
java.lang.Object
jenkins.tasks.SimpleBuildWrapper.Disposer
- All Implemented Interfaces:
Serializable
- Enclosing class:
- SimpleBuildWrapper
An optional callback to run at the end of the wrapped block.
Must be safely serializable, so it receives runtime context comparable to that of the original setup.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Determines whether or not this end-of-wrapped-block callback requires a workspace context (working directory and launcher).void
tearDown
(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) Attempt to clean up anything that was done in the initial setup.void
tearDown
(Run<?, ?> build, TaskListener listener) Attempt to clean up anything that was done in the initial setup.
-
Constructor Details
-
Disposer
public Disposer()
-
-
Method Details
-
requiresWorkspace
@Restricted(org.kohsuke.accmod.restrictions.Beta.class) public final boolean requiresWorkspace()Determines whether or not this end-of-wrapped-block callback requires a workspace context (working directory and launcher).When such a context is required (the default), then
tearDown(Run, FilePath, Launcher, TaskListener)
applies. Otherwise,tearDown(Run, TaskListener)
applies.- Returns:
true
when this end-of-wrapped-block callback requires a workspace context;false
otherwise.- Since:
- 2.258
-
tearDown
public void tearDown(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedExceptionAttempt to clean up anything that was done in the initial setup.This method must be overridden when this end-of-wrapped-block callback requires a workspace context. If such a context is not required, it does not need to be overridden; it will then forward to
tearDown(Run, TaskListener)
.- Parameters:
build
- a build being runworkspace
- a workspace of the buildlauncher
- a way to start commandslistener
- a way to report progress- Throws:
AbstractMethodError
- if this end-of-wrapped-block callback requires a workspace and this method is not overridden.IOException
- if something fails;AbortException
for user errorsInterruptedException
- if tear down is interrupted
-
tearDown
public void tearDown(Run<?, ?> build, TaskListener listener) throws IOException, InterruptedExceptionAttempt to clean up anything that was done in the initial setup.This method must be overridden when this end-of-wrapped-block callback does not require a workspace context, and will not be called when such a context is required.
- Parameters:
build
- a build being runlistener
- a way to report progress- Throws:
AbstractMethodError
- if this this method is not overriddenIllegalStateException
- if this end-of-wrapped-block callback requires a workspaceIOException
- if something fails;AbortException
for user errorsInterruptedException
- if tear down is interrupted- Since:
- 2.258
-