diff src/org/eclipse/jetty/server/AbstractConnector.java @ 818:ad292e148964

remove util/statistic
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 09 Sep 2016 17:09:20 -0600
parents 3428c60d7cfc
children 8e9db0bbf4f9
line wrap: on
line diff
--- 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);
     }
 
     /* ------------------------------------------------------------ */