Merged branch 'jetty-9.4.x' into 'master'.
This commit is contained in:
commit
4329df70b5
|
@ -63,6 +63,7 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements Executo
|
|||
private final ConcurrentStack.NodeStack<ReservedThread> _stack;
|
||||
private final AtomicInteger _size = new AtomicInteger();
|
||||
private final AtomicInteger _pending = new AtomicInteger();
|
||||
private final AtomicInteger _waiting = new AtomicInteger();
|
||||
|
||||
private ThreadPoolBudget.Lease _lease;
|
||||
private Object _owner;
|
||||
|
@ -144,6 +145,12 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements Executo
|
|||
return _pending.get();
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "waiting reserved threads", readonly = true)
|
||||
public int getWaiting()
|
||||
{
|
||||
return _waiting.get();
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "idletimeout in MS", readonly = true)
|
||||
public long getIdleTimeoutMs()
|
||||
{
|
||||
|
@ -255,9 +262,13 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements Executo
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
if (_owner==null)
|
||||
return String.format("%s@%x{s=%d/%d,p=%d}",this.getClass().getSimpleName(),hashCode(),_size.get(),_capacity,_pending.get());
|
||||
return String.format("%s@%s{s=%d/%d,p=%d}",this.getClass().getSimpleName(),_owner,_size.get(),_capacity,_pending.get());
|
||||
return String.format("%s@%s{s=%d/%d,p=%d,w=%d}",
|
||||
getClass().getSimpleName(),
|
||||
_owner != null ? _owner : Integer.toHexString(hashCode()),
|
||||
_size.get(),
|
||||
_capacity,
|
||||
_pending.get(),
|
||||
_waiting.get());
|
||||
}
|
||||
|
||||
private class ReservedThread extends ConcurrentStack.Node implements Runnable
|
||||
|
@ -300,6 +311,7 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements Executo
|
|||
{
|
||||
try
|
||||
{
|
||||
_waiting.incrementAndGet();
|
||||
if (_idleTime == 0)
|
||||
_wakeup.await();
|
||||
else
|
||||
|
@ -309,6 +321,10 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements Executo
|
|||
{
|
||||
LOG.ignore(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_waiting.decrementAndGet();
|
||||
}
|
||||
}
|
||||
task = _task;
|
||||
_task = null;
|
||||
|
|
Loading…
Reference in New Issue