Class AsyncHelper$

java.lang.Object
csw.database.javadsl.AsyncHelper$

public class AsyncHelper$ extends Object
A java helper to schedule and execute blocking operations on a dedicated thread pool. This mechanism will prevent any blocking operation to be scheduled on a thread pool designated for async operations.
  • Field Details

    • MODULE$

      public static final AsyncHelper$ MODULE$
      Static reference to the singleton instance of this Scala object.
  • Constructor Details

    • AsyncHelper$

      public AsyncHelper$()
  • Method Details

    • managedBlock

      public <T> CompletableFuture<T> managedBlock(Supplier<T> supplier)
      The method wraps ForkJoinPool#managedBlock() and executes the provided supplier in a dedicated thread pool for blocking operations

      Parameters:
      supplier - to be scheduled on a thread pool for blocking operations
      Returns:
      a CompletableFuture that waits to complete till the supplier is ready to be executedx in the thread pool and produces the result of type T