improved no progress check
This commit is contained in:
parent
202475aad9
commit
9907125cff
|
@ -13,12 +13,22 @@
|
|||
|
||||
package org.eclipse.jetty.embedded;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.eclipse.jetty.ajp.Ajp13SocketConnector;
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.deploy.DeploymentManager;
|
||||
import org.eclipse.jetty.deploy.providers.ContextProvider;
|
||||
import org.eclipse.jetty.deploy.providers.WebAppProvider;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
|
@ -32,10 +42,11 @@ import org.eclipse.jetty.server.handler.RequestLogHandler;
|
|||
import org.eclipse.jetty.server.handler.StatisticsHandler;
|
||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
||||
import org.eclipse.jetty.server.ssl.SslSocketConnector;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.ExecutorThreadPool;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
||||
|
||||
public class LikeJettyXml
|
||||
{
|
||||
|
@ -70,6 +81,7 @@ public class LikeJettyXml
|
|||
server.setConnectors(new Connector[]
|
||||
{ connector });
|
||||
|
||||
/*
|
||||
SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
|
||||
ssl_connector.setPort(8443);
|
||||
SslContextFactory cf = ssl_connector.getSslContextFactory();
|
||||
|
@ -93,14 +105,17 @@ public class LikeJettyXml
|
|||
ssl_connector.setStatsOn(true);
|
||||
server.addConnector(ssl_connector);
|
||||
ssl_connector.open();
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Ajp13SocketConnector ajp = new Ajp13SocketConnector();
|
||||
ajp.setPort(8009);
|
||||
server.addConnector(ajp);
|
||||
|
||||
*/
|
||||
|
||||
HandlerCollection handlers = new HandlerCollection();
|
||||
ContextHandlerCollection contexts = new ContextHandlerCollection();
|
||||
RequestLogHandler requestLogHandler = new RequestLogHandler();
|
||||
|
@ -143,10 +158,9 @@ public class LikeJettyXml
|
|||
server.setStopAtShutdown(true);
|
||||
server.setSendServerVersion(true);
|
||||
|
||||
|
||||
|
||||
server.start();
|
||||
|
||||
server.join();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -689,6 +689,12 @@ public abstract class AbstractHttpConnection extends AbstractConnection
|
|||
return _connector.getMaxIdleTime();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String toString()
|
||||
{
|
||||
return super.toString()+" "+_parser+" "+_generator+" "+_requests;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -14,8 +14,8 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
|
||||
public class AsyncHttpConnection extends AbstractHttpConnection implements AsyncConnection
|
||||
{
|
||||
private final static int NO_PROGRESS_INFO = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_INFO",1000);
|
||||
private final static int NO_PROGRESS_CLOSE = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_CLOSE",2000);
|
||||
private final static int NO_PROGRESS_INFO = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_INFO",100);
|
||||
private final static int NO_PROGRESS_CLOSE = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_CLOSE",200);
|
||||
|
||||
private static final Logger LOG = Log.getLogger(AsyncHttpConnection.class);
|
||||
private int _total_no_progress;
|
||||
|
@ -77,6 +77,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
|
|||
}
|
||||
finally
|
||||
{
|
||||
some_progress|=progress;
|
||||
// Is this request/response round complete and are fully flushed?
|
||||
if (_parser.isComplete() && _generator.isComplete() && !_endp.isBufferingOutput())
|
||||
{
|
||||
|
@ -111,11 +112,13 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
|
|||
_generator.returnBuffers();
|
||||
|
||||
// Safety net to catch spinning
|
||||
if (!some_progress)
|
||||
if (some_progress)
|
||||
_total_no_progress=0;
|
||||
else
|
||||
{
|
||||
_total_no_progress++;
|
||||
if (NO_PROGRESS_INFO>0 && _total_no_progress%NO_PROGRESS_INFO==0 && (NO_PROGRESS_CLOSE<=0 || _total_no_progress< NO_PROGRESS_CLOSE))
|
||||
LOG.info("EndPoint making no progress: "+_total_no_progress+" "+_endp);
|
||||
LOG.info("EndPoint making no progress: "+_total_no_progress+" "+_endp+" "+this);
|
||||
if (NO_PROGRESS_CLOSE>0 && _total_no_progress==NO_PROGRESS_CLOSE)
|
||||
{
|
||||
LOG.warn("Closing EndPoint making no progress: "+_total_no_progress+" "+_endp+" "+this);
|
||||
|
|
Loading…
Reference in New Issue