Class ThreadPoolBudget

java.lang.Object
org.eclipse.jetty.util.thread.ThreadPoolBudget

@ManagedObject public class ThreadPoolBudget extends Object

A budget of required thread usage, used to warn or error for insufficient configured threads.

See Also:
  • Constructor Details

    • ThreadPoolBudget

      public ThreadPoolBudget(ThreadPool.SizedThreadPool pool)
      Construct a budget for a SizedThreadPool.
      Parameters:
      pool - The pool to budget thread allocation for.
  • Method Details

    • getSizedThreadPool

      public ThreadPool.SizedThreadPool getSizedThreadPool()
    • getLeasedThreads

      @ManagedAttribute("the number of threads leased to components") public int getLeasedThreads()
    • reset

      public void reset()
    • leaseTo

      public ThreadPoolBudget.Lease leaseTo(Object leasee, int threads)
    • check

      public boolean check(int maxThreads) throws IllegalStateException

      Checks leases against the given number of maxThreads.

      Parameters:
      maxThreads - A proposed change to the maximum threads to check.
      Returns:
      true if passes check, false if otherwise (see logs for details)
      Throws:
      IllegalStateException - if insufficient threads are configured.
    • leaseFrom

      public static ThreadPoolBudget.Lease leaseFrom(Executor executor, Object leasee, int threads)