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.

@FunctionalInterface public interface Terminable extends AutoCloseable
An extension of AutoCloseable.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Terminable
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    bindWith(@NotNull TerminableConsumer consumer)
    Binds this terminable with a terminable consumer
    void
    Closes this resource.
    default void
    Closes this resource, and prints the exception if one is thrown.
    default @Nullable Exception
    Silently closes this resource, and returns the exception if one is thrown.
    default boolean
    Gets if the object represented by this instance is already permanently closed.
  • Field Details

  • Method Details

    • close

      void close() throws Exception
      Closes this resource.
      Specified by:
      close in interface AutoCloseable
      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

      @Nullable default @Nullable Exception 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

      default void bindWith(@NotNull @NotNull TerminableConsumer consumer)
      Binds this terminable with a terminable consumer
      Parameters:
      consumer - the terminable consumer