Merged branch 'jetty-9.2.x' into 'master'.
This commit is contained in:
commit
cb5541b58e
|
@ -106,6 +106,8 @@ public class ConnectionPool implements Closeable, Dumpable
|
|||
LOG.debug("Connection {}/{} creation succeeded {}", next, maxConnections, connection);
|
||||
if (activate(connection))
|
||||
connectionPromise.succeeded(connection);
|
||||
else
|
||||
connectionPromise.failed(new IllegalStateException("Active connection overflow"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -172,7 +172,7 @@ public abstract class AbstractEndPoint extends IdleTimeout implements EndPoint
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s@%x{%s<->%d,%s,%s,%s,%s,%s,%d,%s}",
|
||||
return String.format("%s@%x{%s<->%d,%s,%s,%s,%s,%s,%d/%d,%s}",
|
||||
getClass().getSimpleName(),
|
||||
hashCode(),
|
||||
getRemoteAddress(),
|
||||
|
@ -182,6 +182,7 @@ public abstract class AbstractEndPoint extends IdleTimeout implements EndPoint
|
|||
isOutputShutdown()?"OSHUT":"out",
|
||||
_fillInterest.isInterested()?"R":"-",
|
||||
_writeFlusher.isInProgress()?"W":"-",
|
||||
getIdleFor(),
|
||||
getIdleTimeout(),
|
||||
getConnection()==null?null:getConnection().getClass().getSimpleName());
|
||||
}
|
||||
|
|
|
@ -71,6 +71,11 @@ public abstract class IdleTimeout
|
|||
return _idleTimestamp;
|
||||
}
|
||||
|
||||
public long getIdleFor()
|
||||
{
|
||||
return System.currentTimeMillis() - getIdleTimestamp();
|
||||
}
|
||||
|
||||
public long getIdleTimeout()
|
||||
{
|
||||
return _idleTimeout;
|
||||
|
|
|
@ -18,13 +18,17 @@
|
|||
|
||||
package org.eclipse.jetty.util.thread;
|
||||
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
|
||||
/**
|
||||
* Implementation of {@link Scheduler} based on JDK's {@link ScheduledThreadPoolExecutor}.
|
||||
|
@ -34,12 +38,13 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
|||
* queue even if the task did not fire, which provides a huge benefit in the performance
|
||||
* of garbage collection in young generation.
|
||||
*/
|
||||
public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Scheduler
|
||||
public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Scheduler, Dumpable
|
||||
{
|
||||
private final String name;
|
||||
private final boolean daemon;
|
||||
private final ClassLoader classloader;
|
||||
private volatile ScheduledThreadPoolExecutor scheduler;
|
||||
private ClassLoader classloader;
|
||||
private volatile Thread thread;
|
||||
|
||||
public ScheduledExecutorScheduler()
|
||||
{
|
||||
|
@ -66,7 +71,7 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch
|
|||
@Override
|
||||
public Thread newThread(Runnable r)
|
||||
{
|
||||
Thread thread = new Thread(r, name);
|
||||
Thread thread = ScheduledExecutorScheduler.this.thread = new Thread(r, name);
|
||||
thread.setDaemon(daemon);
|
||||
thread.setContextClassLoader(classloader);
|
||||
return thread;
|
||||
|
@ -76,8 +81,6 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch
|
|||
super.doStart();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
|
@ -93,6 +96,23 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch
|
|||
return new ScheduledFutureTask(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
Thread thread = this.thread;
|
||||
if (thread != null)
|
||||
{
|
||||
List<StackTraceElement> frames = Arrays.asList(thread.getStackTrace());
|
||||
ContainerLifeCycle.dump(out, indent, frames);
|
||||
}
|
||||
}
|
||||
|
||||
private class ScheduledFutureTask implements Task
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue