Class BoundedExecutor

java.lang.Object
io.airlift.concurrent.BoundedExecutor
All Implemented Interfaces:
Executor

@ThreadSafe public class BoundedExecutor extends Object implements Executor
Guarantees that no more than maxThreads will be used to execute tasks submitted through execute().

There are a few interesting properties:

  • Multiple BoundedExecutors over a single coreExecutor will have fair sharing of the coreExecutor threads proportional to their relative maxThread counts, but can use less if not as active.
  • Tasks submitted to a BoundedExecutor is guaranteed to have those tasks handed to threads in that order.
  • Will not encounter starvation
  • Constructor Details

    • BoundedExecutor

      public BoundedExecutor(Executor coreExecutor, int maxThreads)
  • Method Details