Interface Disposable
-
- All Superinterfaces:
Serializable
public interface Disposable extends Serializable
Wrapper for a resource to be deleted.dispose()
is called periodically on the resource untilDisposable.State.PURGED
is returned. Exception thrown by the method will be kept and reported to the administrator. Implementation should report success even in case the resource got disposed externally. This is expected in case resource get disposed by administrator after failed attempts was reported. In case the resource is external to Jenkins and can survive Jenkins restart, The implementation needs to be able to correctly locate the resource once deserialized. As long as the Disposable is used byAsyncResourceDisposer
only, it is guaranteed to never run in more than one thread at a time.- Author:
- ogondza
- See Also:
AsyncResourceDisposer.dispose(org.jenkinsci.plugins.resourcedisposer.Disposable...)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Disposable.State
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Disposable.State
dispose()
Dispose the resource.String
getDisplayName()
Text description of the disposable.
-
-
-
Method Detail
-
dispose
@NonNull Disposable.State dispose() throws Throwable
Dispose the resource.- Returns:
- State of the resource after the attempt.
Disposable.State.PURGED
in case the resource do not need to be tracked any longer. - Throws:
Throwable
- Problem disposing the resource. The exception thrown will be reported as a reason the dispose attempt failed.
-
getDisplayName
@NonNull String getDisplayName()
Text description of the disposable.- Returns:
- String providing enough of a hint for admin to know the resource kind and identity. Ex.: "Docker container my/tag"
-
-