Interface Disposable

  • All Superinterfaces:
    Serializable

    public interface Disposable
    extends Serializable
    Wrapper for a resource to be deleted. dispose() is called periodically on the resource until Disposable.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 by AsyncResourceDisposer 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...)
    • 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"