Top Description Inners Fields Constructors Methods
org.eclipse.jetty.io

public Class ConnectionStatistics

extends AbstractLifeCycle
implements Listener, Dumpable
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.io.Connection.Listener, java.util.EventListener
Known Direct Subclasses
org.eclipse.jetty.io.IncludeExcludeConnectionStatistics
Annotations
@ManagedObject:Tracks statistics on connections
Imports
java.io.IOException, java.util.ArrayList, .List, .Map, java.util.concurrent.ConcurrentHashMap, java.util.concurrent.atomic.LongAdder, org.eclipse.jetty.util.annotation.ManagedAttribute, .ManagedObject, .ManagedOperation, org.eclipse.jetty.util.component.AbstractLifeCycle, .Dumpable, org.eclipse.jetty.util.statistic.CounterStatistic, .RateCounter, .SampleStatistic

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 and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final ConnectionStatistics.Stats
private final Map<String, ConnectionStatistics.Stats>
Inherited from org.eclipse.jetty.util.component.AbstractLifeCycle:
FAILEDSTARTEDSTARTINGSTOPPEDSTOPPING

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
doStart()

Overrides org.eclipse.jetty.util.component.AbstractLifeCycle.doStart.

Method to override to start the lifecycle

public void
dump(Appendable
The appendable to dump to
out
,
String
The indent to apply after any new lines.
indent
)

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Dump this object (and children) into an Appendable using the provided indent after any new lines.

public long
public double
public double
public long
public long
public Map<String, ConnectionStatistics.Stats>
public long
public long
public long
public long
public long
public long
public long
public long
public long
public void
private void
protected void
protected void
public void
protected void
protected void
public void
public String
toString()

Overrides org.eclipse.jetty.util.component.AbstractLifeCycle.toString.

Returns a string representation of the object.

Inherited from org.eclipse.jetty.util.component.AbstractLifeCycle:
addEventListenerdoStopgetEventListenersgetStategetStateisFailedisRunningisStartedisStartingisStoppedisStoppingremoveEventListenersetEventListenersstartstop

Field Detail

_statsback to summary
private final ConnectionStatistics.Stats _stats
_statsMapback to summary
private final Map<String, ConnectionStatistics.Stats> _statsMap

Constructor Detail

ConnectionStatisticsback to summary
public ConnectionStatistics()

Method Detail

doStartback to summary
protected void doStart() throws Exception

Overrides org.eclipse.jetty.util.component.AbstractLifeCycle.doStart.

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStart.

Method to override to start the lifecycle

Annotations
@Override
Exceptions
Exception:
If there was a problem starting. Will cause a transition to FAILED state
dumpback to summary
public void dump(Appendable out, String indent) throws IOException

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Doc from org.eclipse.jetty.util.component.Dumpable.dump.

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.

Parameters
out:Appendable

The appendable to dump to

indent:String

The indent to apply after any new lines.

Annotations
@Override
Exceptions
IOException:
if unable to write to Appendable
getConnectionDurationMaxback to summary
public long getConnectionDurationMax()
Annotations
@ManagedAttribute:The max duration of a connection in ms
getConnectionDurationMeanback to summary
public double getConnectionDurationMean()
Annotations
@ManagedAttribute:The mean duration of a connection in ms
getConnectionDurationStdDevback to summary
public double getConnectionDurationStdDev()
Annotations
@ManagedAttribute:The standard deviation of the duration of a connection
getConnectionsback to summary
public long getConnections()
Annotations
@ManagedAttribute:The current number of open connections
getConnectionsMaxback to summary
public long getConnectionsMax()
Annotations
@ManagedAttribute:The max number of open connections
getConnectionStatisticsGroupsback to summary
public Map<String, ConnectionStatistics.Stats> getConnectionStatisticsGroups()
getConnectionsTotalback to summary
public long getConnectionsTotal()
Annotations
@ManagedAttribute:The total number of connections opened
getReceivedBytesback to summary
public long getReceivedBytes()
Annotations
@ManagedAttribute:Total number of bytes received by tracked connections
getReceivedBytesRateback to summary
public long getReceivedBytesRate()
Annotations
@ManagedAttribute:Total number of bytes received per second since the last invocation of this method
getReceivedMessagesback to summary
public long getReceivedMessages()
Annotations
@ManagedAttribute:The total number of messages received
getReceivedMessagesRateback to summary
public long getReceivedMessagesRate()
Annotations
@ManagedAttribute:Total number of messages received per second since the last invocation of this method
getSentBytesback to summary
public long getSentBytes()
Annotations
@ManagedAttribute:Total number of bytes sent by tracked connections
getSentBytesRateback to summary
public long getSentBytesRate()
Annotations
@ManagedAttribute:Total number of bytes sent per second since the last invocation of this method
getSentMessagesback to summary
public long getSentMessages()
Annotations
@ManagedAttribute:The total number of messages sent
getSentMessagesRateback to summary
public long getSentMessagesRate()
Annotations
@ManagedAttribute:Total number of messages sent per second since the last invocation of this method
onClosedback to summary
public void onClosed(Connection connection)

Overrides default org.eclipse.jetty.io.Connection.Listener.onClosed.

Annotations
@Override
onClosedback to summary
private void onClosed(ConnectionStatistics.Stats stats, Connection connection)
onConnectionClosedback to summary
protected void onConnectionClosed(Connection connection)
onConnectionOpenedback to summary
protected void onConnectionOpened(Connection connection)
onOpenedback to summary
public void onOpened(Connection connection)

Overrides default org.eclipse.jetty.io.Connection.Listener.onOpened.

Annotations
@Override
onTotalClosedback to summary
protected void onTotalClosed(Connection connection)
onTotalOpenedback to summary
protected void onTotalOpened(Connection connection)
resetback to summary
public void reset()
Annotations
@ManagedOperation:Resets the statistics
impact:ACTION
toStringback to summary
public String toString()

Overrides org.eclipse.jetty.util.component.AbstractLifeCycle.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jetty.io back to summary

public Class ConnectionStatistics.Stats

extends Object
implements Dumpable
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.component.Dumpable

Field Summary

Modifier and TypeField and Description
private final LongAdder
private final RateCounter
private final LongAdder
private final RateCounter
private final CounterStatistic
private final SampleStatistic
private final LongAdder
private final RateCounter
private final LongAdder
private final RateCounter
private final String

Constructor Summary

AccessConstructor and Description
public
Stats(String name)

Method Summary

Modifier and TypeMethod and Description
public void
public void
dump(Appendable
The appendable to dump to
out
,
String
The indent to apply after any new lines.
indent
)

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Dump this object (and children) into an Appendable using the provided indent after any new lines.

public long
public double
public double
public long
public long
public long
public String
public long
public long
public long
public long
public long
public long
public long
public long
public void
public void
recordBytesIn(long bytesIn)

public void
recordBytesOut(long bytesOut)

public void
recordDuration(long duration)

public void
recordMessagesIn(long messagesIn)

public void
recordMessagesOut(long messagesOut)

public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_bytesInback to summary
private final LongAdder _bytesIn
_bytesInRateback to summary
private final RateCounter _bytesInRate
_bytesOutback to summary
private final LongAdder _bytesOut
_bytesOutRateback to summary
private final RateCounter _bytesOutRate
_connectionsback to summary
private final CounterStatistic _connections
_connectionsDurationback to summary
private final SampleStatistic _connectionsDuration
_messagesInback to summary
private final LongAdder _messagesIn
_messagesInRateback to summary
private final RateCounter _messagesInRate
_messagesOutback to summary
private final LongAdder _messagesOut
_messagesOutRateback to summary
private final RateCounter _messagesOutRate
_nameback to summary
private final String _name

Constructor Detail

Statsback to summary
public Stats(String name)

Method Detail

decrementCountback to summary
public void decrementCount()
dumpback to summary
public void dump(Appendable out, String indent) throws IOException

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Doc from org.eclipse.jetty.util.component.Dumpable.dump.

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.

Parameters
out:Appendable

The appendable to dump to

indent:String

The indent to apply after any new lines.

Annotations
@Override
Exceptions
IOException:
if unable to write to Appendable
getConnectionDurationMaxback to summary
public long getConnectionDurationMax()
getConnectionDurationMeanback to summary
public double getConnectionDurationMean()
getConnectionDurationStdDevback to summary
public double getConnectionDurationStdDev()
getConnectionsback to summary
public long getConnections()
getConnectionsMaxback to summary
public long getConnectionsMax()
getConnectionsTotalback to summary
public long getConnectionsTotal()
getNameback to summary
public String getName()
getReceivedBytesback to summary
public long getReceivedBytes()
getReceivedBytesRateback to summary
public long getReceivedBytesRate()
getReceivedMessagesback to summary
public long getReceivedMessages()
getReceivedMessagesRateback to summary
public long getReceivedMessagesRate()
getSentBytesback to summary
public long getSentBytes()
getSentBytesRateback to summary
public long getSentBytesRate()
getSentMessagesback to summary
public long getSentMessages()
getSentMessagesRateback to summary
public long getSentMessagesRate()
incrementCountback to summary
public void incrementCount()
recordBytesInback to summary
public void recordBytesIn(long bytesIn)
recordBytesOutback to summary
public void recordBytesOut(long bytesOut)
recordDurationback to summary
public void recordDuration(long duration)
recordMessagesInback to summary
public void recordMessagesIn(long messagesIn)
recordMessagesOutback to summary
public void recordMessagesOut(long messagesOut)
resetback to summary
public void reset()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override