Package org.eclipse.jetty.io
Class ConnectionStatistics
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.io.ConnectionStatistics
- All Implemented Interfaces:
EventListener
,Connection.Listener
,Dumpable
,LifeCycle
- Direct Known Subclasses:
IncludeExcludeConnectionStatistics
,ServerConnectionStatistics
@ManagedObject("Tracks statistics on connections")
public class ConnectionStatistics
extends AbstractLifeCycle
implements Connection.Listener, Dumpable
A Connection.Listener
that tracks connection statistics.
Adding an instance of this class as a bean to a ServerConnector or ConnectionFactory (for the server) or to HttpClient (for the client) will trigger the tracking of the connection statistics for all connections managed by the server or by the client.
The statistics for a connection are gathered when the connection is closed.
ConnectionStatistics instances must be started
to collect statistics, either as part of starting the whole component
tree, or explicitly if the component tree has already been started.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopException
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection.Listener
Connection.Listener.Adapter
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
Method to override to start the lifecyclevoid
dump
(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.long
double
double
long
long
long
long
long
long
long
long
long
long
long
void
onClosed
(Connection connection) protected void
onConnectionClosed
(Connection connection) protected void
onConnectionOpened
(Connection connection) void
onOpened
(Connection connection) protected void
onTotalClosed
(Connection connection) protected void
onTotalOpened
(Connection connection) void
reset()
toString()
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addEventListener, doStop, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop
-
Constructor Details
-
ConnectionStatistics
public ConnectionStatistics()
-
-
Method Details
-
reset
-
doStart
Description copied from class:AbstractLifeCycle
Method to override to start the lifecycle- Overrides:
doStart
in classAbstractLifeCycle
- Throws:
AbstractLifeCycle.StopException
- If thrown, the lifecycle will immediately be stopped.Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
onOpened
- Specified by:
onOpened
in interfaceConnection.Listener
-
onTotalOpened
-
onConnectionOpened
-
onClosed
- Specified by:
onClosed
in interfaceConnection.Listener
-
onTotalClosed
-
onConnectionClosed
-
getReceivedBytes
@ManagedAttribute("Total number of bytes received by tracked connections") public long getReceivedBytes() -
getReceivedBytesRate
@ManagedAttribute("Total number of bytes received per second since the last invocation of this method") public long getReceivedBytesRate() -
getSentBytes
-
getSentBytesRate
@ManagedAttribute("Total number of bytes sent per second since the last invocation of this method") public long getSentBytesRate() -
getConnectionDurationMax
-
getConnectionDurationMean
@ManagedAttribute("The mean duration of a connection in ms") public double getConnectionDurationMean() -
getConnectionDurationStdDev
@ManagedAttribute("The standard deviation of the duration of a connection") public double getConnectionDurationStdDev() -
getConnectionsTotal
-
getConnections
-
getConnectionsMax
-
getReceivedMessages
-
getReceivedMessagesRate
@ManagedAttribute("Total number of messages received per second since the last invocation of this method") public long getReceivedMessagesRate() -
getSentMessages
-
getSentMessagesRate
@ManagedAttribute("Total number of messages sent per second since the last invocation of this method") public long getSentMessagesRate() -
getConnectionStatisticsGroups
-
dump
Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dump
in interfaceDumpable
- Parameters:
out
- The appendable to dump toindent
- The indent to apply after any new lines.- Throws:
IOException
- if unable to write to Appendable
-
toString
- Overrides:
toString
in classAbstractLifeCycle
-