Class ConcurrentExecutor

java.lang.Object
io.github.ascopes.protobufmavenplugin.utils.ConcurrentExecutor

@Named @Singleton public final class ConcurrentExecutor extends Object
Helper component that allows scheduling IO-bound tasks within a thread pool.
Since:
2.2.0
Author:
Ashley Scopes
  • Constructor Details

    • ConcurrentExecutor

      @Inject public ConcurrentExecutor()
  • Method Details

    • destroy

      @PreDestroy public void destroy()
      Destroy the internal thread pool.
    • submit

      public <R> FutureTask<R> submit(Callable<R> task)
    • awaiting

      public <R> Collector<FutureTask<R>,?,List<R>> awaiting()
      Return a reactive collector of all the results of a stream of scheduled tasks.
      Type Parameters:
      R - the task return type.
      Returns:
      the collector.
      Throws:
      io.github.ascopes.protobufmavenplugin.utils.MultipleFailuresException - if any of the results raised exceptions. All results are collected prior to this being raised.