Interface AsynchronousCloseable

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
ApplicationInstance, Context<T>, Glue, GlueApplication, GlueEvent.Subscription<E>, IntentListenerRegistration, MethodRegistration, Search<T>, Sheet<T>, StreamConsumer<T>, StreamProducer, StreamSubscription, Window
All Known Implementing Classes:
MethodSearch, ServerSearch, Tick42Glue

public interface AsynchronousCloseable extends AutoCloseable
A resource that can be closed in a non-blocking manner.

For convenience extends AutoCloseable in order to be usable in try-with-resource blocks (in which case, the blocking close() is used).

  • Method Details

    • onClose

      CompletionStage<Void> onClose()
      Return a stage that will complete when closeAsync() is called and shutdown completes.
      Returns:
      a stage that will complete when shutdown is complete, never null
    • closeAsync

      CompletionStage<Void> closeAsync()
      Initiates a shutdown.
      Returns:
      a stage that will complete when shutdown is complete, never null
    • close

      default void close()

      Implemented by calling closeAsync() and blocking on the result. Should not be called on a non-blocking thread.

      Specified by:
      close in interface AutoCloseable