@FunctionalInterface public interface Terminable extends AutoCloseable
AutoCloseable.| Modifier and Type | Field and Description |
|---|---|
static Terminable |
EMPTY |
| Modifier and Type | Method and Description |
|---|---|
default void |
bindWith(TerminableConsumer consumer)
Binds this terminable with a terminable consumer
|
void |
close()
Closes this resource.
|
default void |
closeAndReportException()
Closes this resource, and prints the exception if one is thrown.
|
default Exception |
closeSilently()
Silently closes this resource, and returns the exception if one is thrown.
|
default boolean |
isClosed()
Gets if the object represented by this instance is already permanently closed.
|
static final Terminable EMPTY
void close()
throws Exception
close in interface AutoCloseableExceptiondefault boolean isClosed()
@Nullable default Exception closeSilently()
default void closeAndReportException()
default void bindWith(@Nonnull TerminableConsumer consumer)
consumer - the terminable consumerCopyright © 2022. All rights reserved.