Class ThreadPoolBudget
java.lang.Object
org.eclipse.jetty.util.thread.ThreadPoolBudget
A budget of required thread usage, used to warn or error for insufficient configured threads.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceclassAn allocation of threads -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Set<ThreadPoolBudget.Leased> private static final Loggerprivate static final ThreadPoolBudget.Leaseprivate final ThreadPool.SizedThreadPoolprivate final intprivate final AtomicBoolean -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a budget for a SizedThreadPool.ThreadPoolBudget(ThreadPool.SizedThreadPool pool, int warnAt) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheck(int maxThreads) Checks leases against the given number ofmaxThreads.intstatic ThreadPoolBudget.Leaseprivate voidvoidreset()
-
Field Details
-
LOG
-
NOOP_LEASE
-
leases
-
warned
-
pool
-
warnAt
private final int warnAt
-
-
Constructor Details
-
ThreadPoolBudget
Construct a budget for a SizedThreadPool.- Parameters:
pool- The pool to budget thread allocation for.
-
ThreadPoolBudget
Deprecated.- Parameters:
pool- The pool to budget thread allocation for.warnAt- The level of free threads at which a warning is generated.
-
-
Method Details
-
getSizedThreadPool
-
getLeasedThreads
-
reset
public void reset() -
leaseTo
-
check
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.
-
printInfoOnLeases
private void printInfoOnLeases() -
leaseFrom
-