Package com.tick42.glue.core
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
AutoCloseablein order to be usable in try-with-resource blocks (in which case, the blockingclose()is used).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()CompletionStage<Void>closeAsync()Initiates a shutdown.CompletionStage<Void>onClose()Return a stage that will complete whencloseAsync()is called and shutdown completes.
-
-
-
Method Detail
-
onClose
CompletionStage<Void> onClose()
Return a stage that will complete whencloseAsync()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:
closein interfaceAutoCloseable
-
-