@FunctionalInterface
public interface Disposable
Call to the dispose method is/should be idempotent.
限定符和类型 | 接口和说明 |
---|---|
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. |
限定符和类型 | 方法和说明 |
---|---|
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.