Class Helper

java.lang.Object
org.aesh.terminal.utils.Helper

public class Helper extends Object
Utility methods for handling asynchronous operations with CompletableFuture.
Author:
Ståle W. Pedersen
  • Method Details

    • startedHandler

      public static Consumer<Throwable> startedHandler(CompletableFuture<?> fut)
      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

      public static Consumer<Throwable> stoppedHandler(CompletableFuture<?> fut)
      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