Class AsyncUtil

java.lang.Object
dev.webfx.platform.async.AsyncUtil

public final class AsyncUtil extends Object
Author:
Bruno Salmon
  • Constructor Details

    • AsyncUtil

      public AsyncUtil()
  • Method Details

    • runAsync

      public static <R> Future<R> runAsync(Runnable runnable)
      Wrap a runnable into a future that complete immediately or fail if an exception is thrown.
      Parameters:
      runnable - the runnable
      Returns:
      the future
    • consumeAsync

      public static <T, R> Future<R> consumeAsync(Consumer<T> consumer, T arg)
      Wrap a consumer into a future that complete immediately or fail if an exception is thrown.
      Type Parameters:
      T - the argument type
      Parameters:
      consumer - the consumer
      arg - the argument to pass to the consumer
      Returns:
      the future
    • allOf

      public static Future<Void> allOf(Future... futures)