changeset 818:ad292e148964

remove util/statistic
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 09 Sep 2016 17:09:20 -0600
parents eb33d0045bc2
children 17bd0b170ed6
files src/org/eclipse/jetty/server/AbstractConnector.java src/org/eclipse/jetty/server/Connector.java src/org/eclipse/jetty/server/handler/StatisticsHandler.java src/org/eclipse/jetty/util/statistic/CounterStatistic.java src/org/eclipse/jetty/util/statistic/SampleStatistic.java
diffstat 5 files changed, 227 insertions(+), 1196 deletions(-) [+]
line wrap: on
line diff
diff -r eb33d0045bc2 -r ad292e148964 src/org/eclipse/jetty/server/AbstractConnector.java
--- a/src/org/eclipse/jetty/server/AbstractConnector.java	Fri Sep 09 16:43:04 2016 -0600
+++ b/src/org/eclipse/jetty/server/AbstractConnector.java	Fri Sep 09 17:09:20 2016 -0600
@@ -40,8 +40,6 @@
 import org.eclipse.jetty.util.component.Dumpable;
 import org.eclipse.jetty.util.log.Log;
 import org.eclipse.jetty.util.log.Logger;
-import org.eclipse.jetty.util.statistic.CounterStatistic;
-import org.eclipse.jetty.util.statistic.SampleStatistic;
 import org.eclipse.jetty.util.thread.ThreadPool;
 
 /**
@@ -90,15 +88,6 @@
 
     private transient Thread[] _acceptorThreads;
 
-    private final AtomicLong _statsStartedAt = new AtomicLong(-1L);
-
-    /** connections to server */
-    private final CounterStatistic _connectionStats = new CounterStatistic();
-    /** requests per connection */
-    private final SampleStatistic _requestStats = new SampleStatistic();
-    /** duration of a connection */
-    private final SampleStatistic _connectionDurationStats = new SampleStatistic();
-
     protected final HttpBuffersImpl _buffers = new HttpBuffersImpl();
 
     /* ------------------------------------------------------------ */
@@ -985,178 +974,19 @@
     }
 
     /* ------------------------------------------------------------ */
-    /**
-     * @return Get the number of requests handled by this connector since last call of statsReset(). If setStatsOn(false) then this is undefined.
-     */
-    public int getRequests()
-    {
-        return (int)_requestStats.getTotal();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Returns the connectionsDurationTotal.
-     */
-    public long getConnectionsDurationTotal()
-    {
-        return _connectionDurationStats.getTotal();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Number of connections accepted by the server since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public int getConnections()
-    {
-        return (int)_connectionStats.getTotal();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Number of connections currently open that were opened since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public int getConnectionsOpen()
-    {
-        return (int)_connectionStats.getCurrent();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Maximum number of connections opened simultaneously since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public int getConnectionsOpenMax()
-    {
-        return (int)_connectionStats.getMax();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Mean duration in milliseconds of open connections since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public double getConnectionsDurationMean()
-    {
-        return _connectionDurationStats.getMean();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Maximum duration in milliseconds of an open connection since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public long getConnectionsDurationMax()
-    {
-        return _connectionDurationStats.getMax();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Standard deviation of duration in milliseconds of open connections since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public double getConnectionsDurationStdDev()
-    {
-        return _connectionDurationStats.getStdDev();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Mean number of requests per connection since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public double getConnectionsRequestsMean()
-    {
-        return _requestStats.getMean();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Maximum number of requests per connection since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public int getConnectionsRequestsMax()
-    {
-        return (int)_requestStats.getMax();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Standard deviation of number of requests per connection since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public double getConnectionsRequestsStdDev()
-    {
-        return _requestStats.getStdDev();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * Reset statistics.
-     */
-    public void statsReset()
-    {
-        updateNotEqual(_statsStartedAt,-1,System.currentTimeMillis());
-
-        _requestStats.reset();
-        _connectionStats.reset();
-        _connectionDurationStats.reset();
-    }
-
-    /* ------------------------------------------------------------ */
-    public void setStatsOn(boolean on)
-    {
-        if (on && _statsStartedAt.get() != -1)
-            return;
-
-        if (LOG.isDebugEnabled())
-            LOG.debug("Statistics on = " + on + " for " + this);
-
-        statsReset();
-        _statsStartedAt.set(on?System.currentTimeMillis():-1);
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return True if statistics collection is turned on.
-     */
-    public boolean getStatsOn()
-    {
-        return _statsStartedAt.get() != -1;
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Timestamp stats were started at.
-     */
-    public long getStatsOnMs()
-    {
-        long start = _statsStartedAt.get();
-
-        return (start != -1)?(System.currentTimeMillis() - start):0;
-    }
-
-    /* ------------------------------------------------------------ */
     protected void connectionOpened(Connection connection)
     {
-        if (_statsStartedAt.get() == -1)
-            return;
-
-        _connectionStats.increment();
     }
 
     /* ------------------------------------------------------------ */
     protected void connectionUpgraded(Connection oldConnection, Connection newConnection)
     {
-        _requestStats.set((oldConnection instanceof AbstractHttpConnection)?((AbstractHttpConnection)oldConnection).getRequests():0);
     }
 
     /* ------------------------------------------------------------ */
     protected void connectionClosed(Connection connection)
     {
         connection.onClose();
-
-        if (_statsStartedAt.get() == -1)
-            return;
-
-        long duration = System.currentTimeMillis() - connection.getTimeStamp();
-        int requests = (connection instanceof AbstractHttpConnection)?((AbstractHttpConnection)connection).getRequests():0;
-        _requestStats.set(requests);
-        _connectionStats.decrement();
-        _connectionDurationStats.set(duration);
     }
 
     /* ------------------------------------------------------------ */
diff -r eb33d0045bc2 -r ad292e148964 src/org/eclipse/jetty/server/Connector.java
--- a/src/org/eclipse/jetty/server/Connector.java	Fri Sep 09 16:43:04 2016 -0600
+++ b/src/org/eclipse/jetty/server/Connector.java	Fri Sep 09 17:09:20 2016 -0600
@@ -44,344 +44,245 @@
  */
 public interface Connector extends LifeCycle
 { 
-    /* ------------------------------------------------------------ */
-    /**
-     * @return the name of the connector. Defaults to the HostName:port
-     */
-    String getName();
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * Opens the connector 
-     * @throws IOException
-     */
-    void open() throws IOException;
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return the name of the connector. Defaults to the HostName:port
+	 */
+	String getName();
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * Opens the connector 
+	 * @throws IOException
+	 */
+	void open() throws IOException;
 
-    /* ------------------------------------------------------------ */
-    void close() throws IOException;
+	/* ------------------------------------------------------------ */
+	void close() throws IOException;
 
-    /* ------------------------------------------------------------ */
-    void setServer(Server server);
-    
-    /* ------------------------------------------------------------ */
-    Server getServer();
+	/* ------------------------------------------------------------ */
+	void setServer(Server server);
+	
+	/* ------------------------------------------------------------ */
+	Server getServer();
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Returns the request header buffer size in bytes.
-     */
-    int getRequestHeaderSize();
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * Set the size of the buffer to be used for request headers.
-     * @param size The size in bytes.
-     */
-    void setRequestHeaderSize(int size);
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return Returns the request header buffer size in bytes.
+	 */
+	int getRequestHeaderSize();
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * Set the size of the buffer to be used for request headers.
+	 * @param size The size in bytes.
+	 */
+	void setRequestHeaderSize(int size);
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Returns the response header buffer size in bytes.
-     */
-    int getResponseHeaderSize();
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * Set the size of the buffer to be used for request headers.
-     * @param size The size in bytes.
-     */
-    void setResponseHeaderSize(int size);
-    
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return Returns the response header buffer size in bytes.
+	 */
+	int getResponseHeaderSize();
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * Set the size of the buffer to be used for request headers.
+	 * @param size The size in bytes.
+	 */
+	void setResponseHeaderSize(int size);
+	
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @return factory for request buffers
-     */
-    Buffers getRequestBuffers();
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return factory for request buffers
+	 */
+	Buffers getRequestBuffers();
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @return factory for response buffers
-     */
-    Buffers getResponseBuffers();
-    
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Returns the requestBufferSize.
-     */
-    int getRequestBufferSize();
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * Set the size of the content buffer for receiving requests. 
-     * These buffers are only used for active connections that have
-     * requests with bodies that will not fit within the header buffer.
-     * @param requestBufferSize The requestBufferSize to set.
-     */
-    void setRequestBufferSize(int requestBufferSize);
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Returns the responseBufferSize.
-     */
-    int getResponseBufferSize();
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * Set the size of the content buffer for sending responses. 
-     * These buffers are only used for active connections that are sending 
-     * responses with bodies that will not fit within the header buffer.
-     * @param responseBufferSize The responseBufferSize to set.
-     */
-    void setResponseBufferSize(int responseBufferSize);
-    
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return The port to use when redirecting a request if a data constraint of integral is 
-     * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
-     */
-    int getIntegralPort();
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return The schema to use when redirecting a request if a data constraint of integral is 
-     * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
-     */
-    String getIntegralScheme();
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return factory for response buffers
+	 */
+	Buffers getResponseBuffers();
+	
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return Returns the requestBufferSize.
+	 */
+	int getRequestBufferSize();
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * Set the size of the content buffer for receiving requests. 
+	 * These buffers are only used for active connections that have
+	 * requests with bodies that will not fit within the header buffer.
+	 * @param requestBufferSize The requestBufferSize to set.
+	 */
+	void setRequestBufferSize(int requestBufferSize);
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return Returns the responseBufferSize.
+	 */
+	int getResponseBufferSize();
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * Set the size of the content buffer for sending responses. 
+	 * These buffers are only used for active connections that are sending 
+	 * responses with bodies that will not fit within the header buffer.
+	 * @param responseBufferSize The responseBufferSize to set.
+	 */
+	void setResponseBufferSize(int responseBufferSize);
+	
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @param request A request
-     * @return true if the request is integral. This normally means the https schema has been used.
-     */
-    boolean isIntegral(Request request);
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return The port to use when redirecting a request if a data constraint of confidential is 
-     * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
-     */
-    int getConfidentialPort();
-    
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return The schema to use when redirecting a request if a data constraint of confidential is 
-     * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
-     */
-    String getConfidentialScheme();
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * @param request A request
-     * @return true if the request is confidential. This normally means the https schema has been used.
-     */
-    boolean isConfidential(Request request);
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return The port to use when redirecting a request if a data constraint of integral is 
+	 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
+	 */
+	int getIntegralPort();
 
-    /* ------------------------------------------------------------ */
-    /** Customize a request for an endpoint.
-     * Called on every request to allow customization of the request for
-     * the particular endpoint (eg security properties from a SSL connection).
-     * @param endpoint
-     * @param request
-     * @throws IOException
-     */
-    void customize(EndPoint endpoint, Request request) throws IOException;
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return The schema to use when redirecting a request if a data constraint of integral is 
+	 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
+	 */
+	String getIntegralScheme();
 
-    /* ------------------------------------------------------------ */
-    /** Persist an endpoint.
-     * Called after every request if the connection is to remain open.
-     * @param endpoint
-     * @throws IOException
-     */
-    void persist(EndPoint endpoint) throws IOException;
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * @return The hostname representing the interface to which 
-     * this connector will bind, or null for all interfaces.
-     */
-    String getHost();
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * Set the hostname of the interface to bind to.
-     * @param hostname The hostname representing the interface to which 
-     * this connector will bind, or null for all interfaces.
-     */
-    void setHost(String hostname);
+	/* ------------------------------------------------------------ */
+	/**
+	 * @param request A request
+	 * @return true if the request is integral. This normally means the https schema has been used.
+	 */
+	boolean isIntegral(Request request);
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @param port The port to listen of for connections or 0 if any available
-     * port may be used.
-     */
-    void setPort(int port);
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * @return The configured port for the connector or 0 if any available
-     * port may be used.
-     */
-    int getPort();
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * @return The actual port the connector is listening on or
-     * -1 if it has not been opened, or -2 if it has been closed.
-     */
-    int getLocalPort();
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Max Idle time for connections in milliseconds
-     */
-    int getMaxIdleTime();
-    
-    /**
-     * @param ms Max Idle time for connections in milliseconds
-     */
-    void setMaxIdleTime(int ms);
-    
-    /* ------------------------------------------------------------ */
-    int getLowResourceMaxIdleTime();
-    void setLowResourceMaxIdleTime(int ms);
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * @return the underlying socket, channel, buffer etc. for the connector.
-     */
-    Object getConnection();
-    
-    
-    /* ------------------------------------------------------------ */
-    /**
-     * @return true if names resolution should be done.
-     */
-    boolean getResolveNames();
-    
-    
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return The port to use when redirecting a request if a data constraint of confidential is 
+	 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
+	 */
+	int getConfidentialPort();
+	
+
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return The schema to use when redirecting a request if a data constraint of confidential is 
+	 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
+	 */
+	String getConfidentialScheme();
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * @param request A request
+	 * @return true if the request is confidential. This normally means the https schema has been used.
+	 */
+	boolean isConfidential(Request request);
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Get the number of requests handled by this connector
-     * since last call of statsReset(). If setStatsOn(false) then this
-     * is undefined.
-     */
-    public int getRequests();
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Returns the connectionsDurationTotal.
-     */
-    public long getConnectionsDurationTotal();
+	/* ------------------------------------------------------------ */
+	/** Customize a request for an endpoint.
+	 * Called on every request to allow customization of the request for
+	 * the particular endpoint (eg security properties from a SSL connection).
+	 * @param endpoint
+	 * @param request
+	 * @throws IOException
+	 */
+	void customize(EndPoint endpoint, Request request) throws IOException;
 
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Number of connections accepted by the server since
-     * statsReset() called. Undefined if setStatsOn(false).
-     */
-    public int getConnections() ;
-
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Number of connections currently open that were opened
-     * since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public int getConnectionsOpen() ;
-
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Maximum number of connections opened simultaneously
-     * since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public int getConnectionsOpenMax() ;
+	/* ------------------------------------------------------------ */
+	/** Persist an endpoint.
+	 * Called after every request if the connection is to remain open.
+	 * @param endpoint
+	 * @throws IOException
+	 */
+	void persist(EndPoint endpoint) throws IOException;
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return The hostname representing the interface to which 
+	 * this connector will bind, or null for all interfaces.
+	 */
+	String getHost();
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * Set the hostname of the interface to bind to.
+	 * @param hostname The hostname representing the interface to which 
+	 * this connector will bind, or null for all interfaces.
+	 */
+	void setHost(String hostname);
 
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Maximum duration in milliseconds of an open connection
-     * since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public long getConnectionsDurationMax();
-
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Mean duration in milliseconds of open connections
-     * since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public double getConnectionsDurationMean() ;
-
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Standard deviation of duration in milliseconds of
-     * open connections since statsReset() called. Undefined if
-     * setStatsOn(false).
-     */
-    public double getConnectionsDurationStdDev() ;
-
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Mean number of requests per connection
-     * since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public double getConnectionsRequestsMean() ;
-
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Standard Deviation of number of requests per connection
-     * since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public double getConnectionsRequestsStdDev() ;
-
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Maximum number of requests per connection
-     * since statsReset() called. Undefined if setStatsOn(false).
-     */
-    public int getConnectionsRequestsMax();
+	/* ------------------------------------------------------------ */
+	/**
+	 * @param port The port to listen of for connections or 0 if any available
+	 * port may be used.
+	 */
+	void setPort(int port);
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return The configured port for the connector or 0 if any available
+	 * port may be used.
+	 */
+	int getPort();
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return The actual port the connector is listening on or
+	 * -1 if it has not been opened, or -2 if it has been closed.
+	 */
+	int getLocalPort();
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return Max Idle time for connections in milliseconds
+	 */
+	int getMaxIdleTime();
+	
+	/**
+	 * @param ms Max Idle time for connections in milliseconds
+	 */
+	void setMaxIdleTime(int ms);
+	
+	/* ------------------------------------------------------------ */
+	int getLowResourceMaxIdleTime();
+	void setLowResourceMaxIdleTime(int ms);
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return the underlying socket, channel, buffer etc. for the connector.
+	 */
+	Object getConnection();
+	
+	
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return true if names resolution should be done.
+	 */
+	boolean getResolveNames();
+	
+	
 
-    /* ------------------------------------------------------------ */
-    /** Reset statistics.
-     */
-    public void statsReset();
-    
-    /* ------------------------------------------------------------ */
-    public void setStatsOn(boolean on);
-    
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return True if statistics collection is turned on.
-     */
-    public boolean getStatsOn();
-    
-    /* ------------------------------------------------------------ */
-    /** 
-     * @return Timestamp stats were started at.
-     */
-    public long getStatsOnMs();
-    
-
-    /* ------------------------------------------------------------ */
-    /** Check if low on resources.
-     * For most connectors, low resources is measured by calling 
-     * {@link ThreadPool#isLowOnThreads()} on the connector threadpool
-     * or the server threadpool if there is no connector threadpool.
-     * <p>
-     * For blocking connectors, low resources is used to trigger
-     * usage of {@link #getLowResourceMaxIdleTime()} for the timeout
-     * of an idle connection.
-     * <p>
-     * for non-blocking connectors, the number of connections is
-     * used instead of this method, to select the timeout of an 
-     * idle connection.
-     * <p>
-     * For all connectors, low resources is used to trigger the 
-     * usage of {@link #getLowResourceMaxIdleTime()} for read and 
-     * write operations.
-     * 
-     * @return true if this connector is low on resources.
-     */
-    public boolean isLowResources();
+	/* ------------------------------------------------------------ */
+	/** Check if low on resources.
+	 * For most connectors, low resources is measured by calling 
+	 * {@link ThreadPool#isLowOnThreads()} on the connector threadpool
+	 * or the server threadpool if there is no connector threadpool.
+	 * <p>
+	 * For blocking connectors, low resources is used to trigger
+	 * usage of {@link #getLowResourceMaxIdleTime()} for the timeout
+	 * of an idle connection.
+	 * <p>
+	 * for non-blocking connectors, the number of connections is
+	 * used instead of this method, to select the timeout of an 
+	 * idle connection.
+	 * <p>
+	 * For all connectors, low resources is used to trigger the 
+	 * usage of {@link #getLowResourceMaxIdleTime()} for read and 
+	 * write operations.
+	 * 
+	 * @return true if this connector is low on resources.
+	 */
+	public boolean isLowResources();
 }
diff -r eb33d0045bc2 -r ad292e148964 src/org/eclipse/jetty/server/handler/StatisticsHandler.java
--- a/src/org/eclipse/jetty/server/handler/StatisticsHandler.java	Fri Sep 09 16:43:04 2016 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,474 +0,0 @@
-//
-//  ========================================================================
-//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
-//  ------------------------------------------------------------------------
-//  All rights reserved. This program and the accompanying materials
-//  are made available under the terms of the Eclipse Public License v1.0
-//  and Apache License v2.0 which accompanies this distribution.
-//
-//      The Eclipse Public License is available at
-//      http://www.eclipse.org/legal/epl-v10.html
-//
-//      The Apache License v2.0 is available at
-//      http://www.opensource.org/licenses/apache2.0.php
-//
-//  You may elect to redistribute this code under either of these licenses.
-//  ========================================================================
-//
-
-package org.eclipse.jetty.server.handler;
-
-import java.io.IOException;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.jetty.continuation.Continuation;
-import org.eclipse.jetty.continuation.ContinuationListener;
-import org.eclipse.jetty.server.AsyncContinuation;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Response;
-import org.eclipse.jetty.util.statistic.CounterStatistic;
-import org.eclipse.jetty.util.statistic.SampleStatistic;
-
-public class StatisticsHandler extends HandlerWrapper
-{
-    private final AtomicLong _statsStartedAt = new AtomicLong();
-    
-    private final CounterStatistic _requestStats = new CounterStatistic();
-    private final SampleStatistic _requestTimeStats = new SampleStatistic();
-    private final CounterStatistic _dispatchedStats = new CounterStatistic();
-    private final SampleStatistic _dispatchedTimeStats = new SampleStatistic();
-    private final CounterStatistic _suspendStats = new CounterStatistic();
-
-    private final AtomicInteger _resumes = new AtomicInteger();
-    private final AtomicInteger _expires = new AtomicInteger();
-    
-    private final AtomicInteger _responses1xx = new AtomicInteger();
-    private final AtomicInteger _responses2xx = new AtomicInteger();
-    private final AtomicInteger _responses3xx = new AtomicInteger();
-    private final AtomicInteger _responses4xx = new AtomicInteger();
-    private final AtomicInteger _responses5xx = new AtomicInteger();
-    private final AtomicLong _responsesTotalBytes = new AtomicLong();
-
-    private final ContinuationListener _onCompletion = new ContinuationListener()
-    {
-        public void onComplete(Continuation continuation)
-        {
-            final Request request = ((AsyncContinuation)continuation).getBaseRequest();
-            final long elapsed = System.currentTimeMillis()-request.getTimeStamp();
-            
-            _requestStats.decrement();
-            _requestTimeStats.set(elapsed);
-            
-            updateResponse(request);
-            
-            if (!continuation.isResumed())
-                _suspendStats.decrement();
-        }
-
-        public void onTimeout(Continuation continuation)
-        {
-            _expires.incrementAndGet();
-        }
-    };
-    
-    /**
-     * Resets the current request statistics.
-     */
-    public void statsReset()
-    {
-        _statsStartedAt.set(System.currentTimeMillis());
-        
-        _requestStats.reset();
-        _requestTimeStats.reset();
-        _dispatchedStats.reset();
-        _dispatchedTimeStats.reset();
-        _suspendStats.reset();
-
-        _resumes.set(0);
-        _expires.set(0);
-        _responses1xx.set(0);
-        _responses2xx.set(0);
-        _responses3xx.set(0);
-        _responses4xx.set(0);
-        _responses5xx.set(0);
-        _responsesTotalBytes.set(0L);
-    }
-
-    @Override
-    public void handle(String path, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException, ServletException
-    {
-        _dispatchedStats.increment();
-
-        final long start;
-        AsyncContinuation continuation = request.getAsyncContinuation();
-        if (continuation.isInitial())
-        {
-            // new request
-            _requestStats.increment();
-            start = request.getTimeStamp();
-        }
-        else
-        {
-            // resumed request
-            start = System.currentTimeMillis();
-            _suspendStats.decrement();
-            if (continuation.isResumed())
-                _resumes.incrementAndGet();
-        }
-
-        try
-        {
-            super.handle(path, request, httpRequest, httpResponse);
-        }
-        finally
-        {
-            final long now = System.currentTimeMillis();
-            final long dispatched=now-start;
-            
-            _dispatchedStats.decrement();
-            _dispatchedTimeStats.set(dispatched);
-            
-            if (continuation.isSuspended())
-            {
-                if (continuation.isInitial())
-                    continuation.addContinuationListener(_onCompletion);
-                _suspendStats.increment();
-            }
-            else if (continuation.isInitial())
-            {
-                _requestStats.decrement();
-                _requestTimeStats.set(dispatched);
-                updateResponse(request);
-            }
-            // else onCompletion will handle it.
-        }
-    }
-
-    private void updateResponse(Request request)
-    {
-        Response response = request.getResponse();
-        switch (response.getStatus() / 100)
-        {
-            case 1:
-                _responses1xx.incrementAndGet();
-                break;
-            case 2:
-                _responses2xx.incrementAndGet();
-                break;
-            case 3:
-                _responses3xx.incrementAndGet();
-                break;
-            case 4:
-                _responses4xx.incrementAndGet();
-                break;
-            case 5:
-                _responses5xx.incrementAndGet();
-                break;
-            default:
-                break;
-        }
-        _responsesTotalBytes.addAndGet(response.getContentCount());
-    }
-
-    @Override
-    protected void doStart() throws Exception
-    {
-        super.doStart();
-        statsReset();
-    }
-
-    /**
-     * @return the number of requests handled by this handler
-     * since {@link #statsReset()} was last called, excluding
-     * active requests
-     * @see #getResumes()
-     */
-    public int getRequests()
-    {
-        return (int)_requestStats.getTotal();
-    }
-
-    /**
-     * @return the number of requests currently active.
-     * since {@link #statsReset()} was last called.
-     */
-    public int getRequestsActive()
-    {
-        return (int)_requestStats.getCurrent();
-    }
-
-    /**
-     * @return the maximum number of active requests
-     * since {@link #statsReset()} was last called.
-     */
-    public int getRequestsActiveMax()
-    {
-        return (int)_requestStats.getMax();
-    }
-
-    /**
-     * @return the maximum time (in milliseconds) of request handling
-     * since {@link #statsReset()} was last called.
-     */
-    public long getRequestTimeMax()
-    {
-        return _requestTimeStats.getMax();
-    }
-
-    /**
-     * @return the total time (in milliseconds) of requests handling
-     * since {@link #statsReset()} was last called.
-     */
-    public long getRequestTimeTotal()
-    {
-        return _requestTimeStats.getTotal();
-    }
-
-    /**
-     * @return the mean time (in milliseconds) of request handling
-     * since {@link #statsReset()} was last called.
-     * @see #getRequestTimeTotal()
-     * @see #getRequests()
-     */
-    public double getRequestTimeMean()
-    {
-        return _requestTimeStats.getMean();
-    }
-
-    /**
-     * @return the standard deviation of time (in milliseconds) of request handling
-     * since {@link #statsReset()} was last called.
-     * @see #getRequestTimeTotal()
-     * @see #getRequests()
-     */
-    public double getRequestTimeStdDev()
-    {
-        return _requestTimeStats.getStdDev();
-    }
-
-    /**
-     * @return the number of dispatches seen by this handler
-     * since {@link #statsReset()} was last called, excluding
-     * active dispatches
-     */
-    public int getDispatched()
-    {
-        return (int)_dispatchedStats.getTotal();
-    }
-
-    /**
-     * @return the number of dispatches currently in this handler
-     * since {@link #statsReset()} was last called, including
-     * resumed requests
-     */
-    public int getDispatchedActive()
-    {
-        return (int)_dispatchedStats.getCurrent();
-    }
-
-    /**
-     * @return the max number of dispatches currently in this handler
-     * since {@link #statsReset()} was last called, including
-     * resumed requests
-     */
-    public int getDispatchedActiveMax()
-    {
-        return (int)_dispatchedStats.getMax();
-    }
-
-    /**
-     * @return the maximum time (in milliseconds) of request dispatch
-     * since {@link #statsReset()} was last called.
-     */
-    public long getDispatchedTimeMax()
-    {
-        return _dispatchedTimeStats.getMax();
-    }
-    
-    /**
-     * @return the total time (in milliseconds) of requests handling
-     * since {@link #statsReset()} was last called.
-     */
-    public long getDispatchedTimeTotal()
-    {
-        return _dispatchedTimeStats.getTotal();
-    }
-
-    /**
-     * @return the mean time (in milliseconds) of request handling
-     * since {@link #statsReset()} was last called.
-     * @see #getRequestTimeTotal()
-     * @see #getRequests()
-     */
-    public double getDispatchedTimeMean()
-    {
-        return _dispatchedTimeStats.getMean();
-    }
-    
-    /**
-     * @return the standard deviation of time (in milliseconds) of request handling
-     * since {@link #statsReset()} was last called.
-     * @see #getRequestTimeTotal()
-     * @see #getRequests()
-     */
-    public double getDispatchedTimeStdDev()
-    {
-        return _dispatchedTimeStats.getStdDev();
-    }
-    
-    /**
-     * @return the number of requests handled by this handler
-     * since {@link #statsReset()} was last called, including
-     * resumed requests
-     * @see #getResumes()
-     */
-    public int getSuspends()
-    {
-        return (int)_suspendStats.getTotal();
-    }
-
-    /**
-     * @return the number of requests currently suspended.
-     * since {@link #statsReset()} was last called.
-     */
-    public int getSuspendsActive()
-    {
-        return (int)_suspendStats.getCurrent();
-    }
-
-    /**
-     * @return the maximum number of current suspended requests
-     * since {@link #statsReset()} was last called.
-     */
-    public int getSuspendsActiveMax()
-    {
-        return (int)_suspendStats.getMax();
-    }
-    
-    /**
-     * @return the number of requests that have been resumed
-     * @see #getExpires()
-     */
-    public int getResumes()
-    {
-        return _resumes.get();
-    }
-
-    /**
-     * @return the number of requests that expired while suspended.
-     * @see #getResumes()
-     */
-    public int getExpires()
-    {
-        return _expires.get();
-    }
-
-    /**
-     * @return the number of responses with a 1xx status returned by this context
-     * since {@link #statsReset()} was last called.
-     */
-    public int getResponses1xx()
-    {
-        return _responses1xx.get();
-    }
-
-    /**
-     * @return the number of responses with a 2xx status returned by this context
-     * since {@link #statsReset()} was last called.
-     */
-    public int getResponses2xx()
-    {
-        return _responses2xx.get();
-    }
-
-    /**
-     * @return the number of responses with a 3xx status returned by this context
-     * since {@link #statsReset()} was last called.
-     */
-    public int getResponses3xx()
-    {
-        return _responses3xx.get();
-    }
-
-    /**
-     * @return the number of responses with a 4xx status returned by this context
-     * since {@link #statsReset()} was last called.
-     */
-    public int getResponses4xx()
-    {
-        return _responses4xx.get();
-    }
-
-    /**
-     * @return the number of responses with a 5xx status returned by this context
-     * since {@link #statsReset()} was last called.
-     */
-    public int getResponses5xx()
-    {
-        return _responses5xx.get();
-    }
-
-    /**
-     * @return the milliseconds since the statistics were started with {@link #statsReset()}.
-     */
-    public long getStatsOnMs()
-    {
-        return System.currentTimeMillis() - _statsStartedAt.get();
-    }
-    
-    /**
-     * @return the total bytes of content sent in responses
-     */
-    public long getResponsesBytesTotal()
-    {
-        return _responsesTotalBytes.get();
-    }
-    
-    public String toStatsHTML()
-    {   
-        StringBuilder sb = new StringBuilder();
-
-        sb.append("<h1>Statistics:</h1>\n");
-        sb.append("Statistics gathering started ").append(getStatsOnMs()).append("ms ago").append("<br />\n");
-
-        sb.append("<h2>Requests:</h2>\n");
-        sb.append("Total requests: ").append(getRequests()).append("<br />\n");
-        sb.append("Active requests: ").append(getRequestsActive()).append("<br />\n");
-        sb.append("Max active requests: ").append(getRequestsActiveMax()).append("<br />\n");
-        sb.append("Total requests time: ").append(getRequestTimeTotal()).append("<br />\n");
-        sb.append("Mean request time: ").append(getRequestTimeMean()).append("<br />\n");
-        sb.append("Max request time: ").append(getRequestTimeMax()).append("<br />\n");
-        sb.append("Request time standard deviation: ").append(getRequestTimeStdDev()).append("<br />\n");
-        
-
-        sb.append("<h2>Dispatches:</h2>\n");
-        sb.append("Total dispatched: ").append(getDispatched()).append("<br />\n");
-        sb.append("Active dispatched: ").append(getDispatchedActive()).append("<br />\n");
-        sb.append("Max active dispatched: ").append(getDispatchedActiveMax()).append("<br />\n");
-        sb.append("Total dispatched time: ").append(getDispatchedTimeTotal()).append("<br />\n");
-        sb.append("Mean dispatched time: ").append(getDispatchedTimeMean()).append("<br />\n");
-        sb.append("Max dispatched time: ").append(getDispatchedTimeMax()).append("<br />\n");
-        sb.append("Dispatched time standard deviation: ").append(getDispatchedTimeStdDev()).append("<br />\n");
-
-
-        sb.append("Total requests suspended: ").append(getSuspends()).append("<br />\n");
-        sb.append("Total requests expired: ").append(getExpires()).append("<br />\n");
-        sb.append("Total requests resumed: ").append(getResumes()).append("<br />\n");
-        
-        sb.append("<h2>Responses:</h2>\n");
-        sb.append("1xx responses: ").append(getResponses1xx()).append("<br />\n");
-        sb.append("2xx responses: ").append(getResponses2xx()).append("<br />\n");
-        sb.append("3xx responses: ").append(getResponses3xx()).append("<br />\n");
-        sb.append("4xx responses: ").append(getResponses4xx()).append("<br />\n");
-        sb.append("5xx responses: ").append(getResponses5xx()).append("<br />\n");
-        sb.append("Bytes sent total: ").append(getResponsesBytesTotal()).append("<br />\n");
-
-        return sb.toString();
-
-    }
-}
diff -r eb33d0045bc2 -r ad292e148964 src/org/eclipse/jetty/util/statistic/CounterStatistic.java
--- a/src/org/eclipse/jetty/util/statistic/CounterStatistic.java	Fri Sep 09 16:43:04 2016 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-//
-//  ========================================================================
-//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
-//  ------------------------------------------------------------------------
-//  All rights reserved. This program and the accompanying materials
-//  are made available under the terms of the Eclipse Public License v1.0
-//  and Apache License v2.0 which accompanies this distribution.
-//
-//      The Eclipse Public License is available at
-//      http://www.eclipse.org/legal/epl-v10.html
-//
-//      The Apache License v2.0 is available at
-//      http://www.opensource.org/licenses/apache2.0.php
-//
-//  You may elect to redistribute this code under either of these licenses.
-//  ========================================================================
-//
-
-package org.eclipse.jetty.util.statistic;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.eclipse.jetty.util.Atomics;
-
-
-/* ------------------------------------------------------------ */
-/** Statistics on a counter value.
- * <p>
- * Keep total, current and maximum values of a counter that
- * can be incremented and decremented. The total refers only
- * to increments.
- *
- */
-public class CounterStatistic
-{
-    protected final AtomicLong _max = new AtomicLong();
-    protected final AtomicLong _curr = new AtomicLong();
-    protected final AtomicLong _total = new AtomicLong();
-
-    /* ------------------------------------------------------------ */
-    public void reset()
-    {
-        reset(0);
-    }
-
-    /* ------------------------------------------------------------ */
-    public void reset(final long value)
-    {
-        _max.set(value);
-        _curr.set(value);
-        _total.set(0); // total always set to 0 to properly calculate cumulative total
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @param delta the amount to add to the count
-     */
-    public void add(final long delta)
-    {
-        long value=_curr.addAndGet(delta);
-        if (delta > 0)
-            _total.addAndGet(delta);
-        Atomics.updateMax(_max,value);
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @param delta the amount to subtract the count by.
-     */
-    public void subtract(final long delta)
-    {
-        add(-delta);
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     */
-    public void increment()
-    {
-        add(1);
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     */
-    public void decrement()
-    {
-        add(-1);
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return max value
-     */
-    public long getMax()
-    {
-        return _max.get();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return current value
-     */
-    public long getCurrent()
-    {
-        return _curr.get();
-    }
-
-    /* ------------------------------------------------------------ */
-    /**
-     * @return total value
-     */
-    public long getTotal()
-    {
-        return _total.get();
-    }
-}
diff -r eb33d0045bc2 -r ad292e148964 src/org/eclipse/jetty/util/statistic/SampleStatistic.java
--- a/src/org/eclipse/jetty/util/statistic/SampleStatistic.java	Fri Sep 09 16:43:04 2016 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-//
-//  ========================================================================
-//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
-//  ------------------------------------------------------------------------
-//  All rights reserved. This program and the accompanying materials
-//  are made available under the terms of the Eclipse Public License v1.0
-//  and Apache License v2.0 which accompanies this distribution.
-//
-//      The Eclipse Public License is available at
-//      http://www.eclipse.org/legal/epl-v10.html
-//
-//      The Apache License v2.0 is available at
-//      http://www.opensource.org/licenses/apache2.0.php
-//
-//  You may elect to redistribute this code under either of these licenses.
-//  ========================================================================
-//
-
-package org.eclipse.jetty.util.statistic;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.eclipse.jetty.util.Atomics;
-
-
-/* ------------------------------------------------------------ */
-/**
- * SampledStatistics
- * <p>
- * Provides max, total, mean, count, variance, and standard
- * deviation of continuous sequence of samples.
- * <p>
- * Calculates estimates of mean, variance, and standard deviation
- * characteristics of a sample using a non synchronized
- * approximation of the on-line algorithm presented
- * in Donald Knuth's Art of Computer Programming, Volume 2,
- * Seminumerical Algorithms, 3rd edition, page 232,
- * Boston: Addison-Wesley. that cites a 1962 paper by B.P. Welford
- * that can be found by following the link http://www.jstor.org/pss/1266577
- * <p>
- * This algorithm is also described in Wikipedia at
- * http://en.wikipedia.org/w/index.php?title=Algorithms_for_calculating_variance&section=4#On-line_algorithm
- */
-public class SampleStatistic
-{
-    protected final AtomicLong _max = new AtomicLong();
-    protected final AtomicLong _total = new AtomicLong();
-    protected final AtomicLong _count = new AtomicLong();
-    protected final AtomicLong _totalVariance100 = new AtomicLong();
-
-    public void reset()
-    {
-        _max.set(0);
-        _total.set(0);
-        _count.set(0);
-        _totalVariance100.set(0);
-    }
-
-    public void set(final long sample)
-    {
-        long total = _total.addAndGet(sample);
-        long count = _count.incrementAndGet();
-
-        if (count>1)
-        {
-            long mean10 = total*10/count;
-            long delta10 = sample*10 - mean10;
-            _totalVariance100.addAndGet(delta10*delta10);
-        }
-
-        Atomics.updateMax(_max, sample);
-    }
-
-    /**
-     * @return the max value
-     */
-    public long getMax()
-    {
-        return _max.get();
-    }
-
-    public long getTotal()
-    {
-        return _total.get();
-    }
-
-    public long getCount()
-    {
-        return _count.get();
-    }
-
-    public double getMean()
-    {
-        return (double)_total.get()/_count.get();
-    }
-
-    public double getVariance()
-    {
-        final long variance100 = _totalVariance100.get();
-        final long count = _count.get();
-
-        return count>1?((double)variance100)/100.0/(count-1):0.0;
-    }
-
-    public double getStdDev()
-    {
-        return Math.sqrt(getVariance());
-    }
-}