Package com.iizix.comm.statistics
Class SessionStatistics
java.lang.Object
com.iizix.comm.statistics.SessionStatistics
Statistics of a transaction session, including all connections.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorDescriptionCreates a new instance for the Session Transaction Manager.Method Summary
Modifier and TypeMethodDescriptionGets the current state.Gets the current connection statistics.long
Gets the time when the session began to be dormant.Gets the history of connection statistics.long
Gets the time of the last activity of the session, used for time-out checking.long
Gets the last connection time.Gets a copy of all properties of the last or current connection.getProperty
(String name, boolean searchPrevious) Gets a property.Clones this instance.void
onPong
(long duration) Called when a pong transaction is received.void
onReceived
(int size) Called when a transaction is received.void
onReceived
(ReadTransaction trans) Called when a transaction is received.void
onSent
(int size) Called when data has been sent.void
onSent
(SendTransaction trans) Called when a transaction is sent.void
Called when the connection is closed.void
Called when the connection is connected.void
setHeartBeatDuration
(long duration) Sets the last web socket heart-beat duration (the PING-PONG message exchange in nanoseconds).void
setProperty
(String name, String value) Sets a property for the connection.void
setReconnected
(SessionStatistics other) Called when the connection is re-connected.
Constructor Details
SessionStatistics
public SessionStatistics()Creates a new instance for the Session Transaction Manager.
Method Details
setProperty
Sets a property for the connection.getProperty
Gets a property.- Parameters:
name
- The property name.searchPrevious
- Flag indicating previous connections should be included in locating the property. Searching is done backwards in history.- Returns:
- The value, or null if not found.
getProperties
Gets a copy of all properties of the last or current connection.- Returns:
- The copy of the properties, or null if none are present.
getLastConnectionTime
public long getLastConnectionTime()Gets the last connection time.- Returns:
- The time in milliseconds like System.currentTimeMillis(), or zero if not connected ever.
getLastActivityTime
public long getLastActivityTime()Gets the time of the last activity of the session, used for time-out checking.getDormantStartTime
public long getDormantStartTime()Gets the time when the session began to be dormant.- Returns:
- Zero if session is not dormant.
getStatisticsSnapshot
Clones this instance.onSent
Called when a transaction is sent.onSent
public void onSent(int size) Called when data has been sent.onReceived
Called when a transaction is received.onReceived
public void onReceived(int size) Called when a transaction is received.setConnected
public void setConnected()Called when the connection is connected. An error is logged if current state is not INITIALIZING.setClosed
Called when the connection is closed. An error is logged if current state is not INITIALIZING or CONNECTED.- Parameters:
reason
- The reason state.
setReconnected
Called when the connection is re-connected. An error is logged if current state is not PAUSED or BROKEN.getCurrentState
Gets the current state.onPong
public void onPong(long duration) Called when a pong transaction is received.- Parameters:
duration
- The turn-around time in IIZI transactions, i.e. on the application layer between server app and client app, big difference with heart-beat duration that is working on a lower level close to the WebSocket and more at system level rather than the application level.
setHeartBeatDuration
public void setHeartBeatDuration(long duration) Sets the last web socket heart-beat duration (the PING-PONG message exchange in nanoseconds).getCurrentStatitics
Gets the current connection statistics.getHistory
Gets the history of connection statistics.- Returns:
- The array of statistics for the history, or null if none is available.