Package org.eclipse.jetty.util.thread
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 interface
class
An allocation of threads -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Set
<ThreadPoolBudget.Leased> private static final Logger
private static final ThreadPoolBudget.Lease
private final ThreadPool.SizedThreadPool
private final int
private final AtomicBoolean
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a budget for a SizedThreadPool.ThreadPoolBudget
(ThreadPool.SizedThreadPool pool, int warnAt) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionboolean
check
(int maxThreads) Checks leases against the given number ofmaxThreads
.int
static ThreadPoolBudget.Lease
private void
void
reset()
-
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
-