Package dev.demeng.pluginbase.terminable
Interface Terminable
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
CompositeTerminable,DependencyContainer,MergedSubscription<T>,Promise<V>,ServerThreadLock,SingleSubscription<T>,Subscription,Task
- All Known Implementing Classes:
AbstractCompositeTerminable,AbstractWeakCompositeTerminable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An extension of
AutoCloseable.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidbindWith(@NotNull TerminableConsumer consumer) Binds this terminable with a terminable consumervoidclose()Closes this resource.default voidCloses this resource, and prints the exception if one is thrown.default @Nullable ExceptionSilently closes this resource, and returns the exception if one is thrown.default booleanisClosed()Gets if the object represented by this instance is already permanently closed.
-
Field Details
-
EMPTY
-
-
Method Details
-
close
Closes this resource.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
isClosed
default boolean isClosed()Gets if the object represented by this instance is already permanently closed.- Returns:
- true if this terminable is closed permanently
-
closeSilently
Silently closes this resource, and returns the exception if one is thrown.- Returns:
- the exception is one is thrown
-
closeAndReportException
default void closeAndReportException()Closes this resource, and prints the exception if one is thrown. -
bindWith
Binds this terminable with a terminable consumer- Parameters:
consumer- the terminable consumer
-