@FunctionalInterface public interface Disposable
Call to the dispose method is/should be idempotent.
Modifier and Type | Interface and Description |
---|---|
static interface |
Disposable.Composite
A container of
Disposable that is itself Disposable . |
static interface |
Disposable.Swap
A
Disposable container that allows updating/replacing its inner Disposable
atomically and with respect of disposing the container itself. |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Cancel or dispose the underlying task or resource.
|
default boolean |
isDisposed()
Optionally return true when the resource or task is disposed.
|
void dispose()
Implementations are required to make this method idempotent.
default boolean isDisposed()
Implementations are not required to track disposition and as such may never return true even when disposed. However, they MUST only return true when there's a guarantee the resource or task is disposed.