Package org.aesh.terminal.utils
Class Helper
java.lang.Object
org.aesh.terminal.utils.Helper
Utility methods for handling asynchronous operations with CompletableFuture.
- Author:
- Ståle W. Pedersen
-
Method Summary
Modifier and TypeMethodDescriptionstartedHandler(CompletableFuture<?> fut) Create a handler that completes a future when a start operation finishes.stoppedHandler(CompletableFuture<?> fut) Create a handler that completes a future when a stop operation finishes.
-
Method Details
-
startedHandler
Create a handler that completes a future when a start operation finishes. If the operation succeeds (null error), the future completes normally. If the operation fails, the future completes exceptionally.- Parameters:
fut- the future to complete- Returns:
- a consumer that handles the completion result
-
stoppedHandler
Create a handler that completes a future when a stop operation finishes. The future always completes normally, regardless of any error.- Parameters:
fut- the future to complete- Returns:
- a consumer that handles the completion result
-