Package com.iizix.comm.statistics
Class SessionStatistics
- java.lang.Object
- com.iizix.comm.statistics.SessionStatistics
public class SessionStatistics extends java.lang.ObjectStatistics of a transaction session, including all connections.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description SessionStatistics()Creates a new instance for the Session Transaction Manager.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SessionConnectionStatistics.StategetCurrentState()Gets the current state.SessionConnectionStatisticsgetCurrentStatitics()Gets the current connection statistics.longgetDormantStartTime()Gets the time when the session began to be dormant.SessionConnectionStatistics[]getHistory()Gets the history of connection statistics.longgetLastActivityTime()Gets the time of the last activity of the session, used for time-out checking.longgetLastConnectionTime()Gets the last connection time.java.util.Map<java.lang.String,java.lang.String>getProperties()Gets a copy of all properties of the last or current connection.java.lang.StringgetProperty(java.lang.String name, boolean searchPrevious)Gets a property.SessionStatisticsgetStatisticsSnapshot()Clones this instance.voidonPong(long time)Called when a pong transaction is received.voidonReceived(int size)Called when a transaction is received.voidonReceived(ReadTransaction trans)Called when a transaction is received.voidonSent(int size)Called when data has been sent.voidonSent(SendTransaction trans)Called when a transaction is sent.voidsetClosed(SessionConnectionStatistics.State reason)Called when the connection is closed.voidsetConnected()Called when the connection is connected.voidsetHeartBeatDuration(long duration)Sets the last web socket heart-beat duration (the PING-PONG message exchange in milliseconds).voidsetProperty(java.lang.String name, java.lang.String value)Sets a property for the connection.voidsetReconnected(SessionStatistics other)Called when the connection is re-connected.
Method Detail
setProperty
public void setProperty(java.lang.String name, java.lang.String value)Sets a property for the connection.
getProperty
public java.lang.String getProperty(java.lang.String name, boolean searchPrevious)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
public java.util.Map<java.lang.String,java.lang.String> 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
public SessionStatistics getStatisticsSnapshot()
Clones this instance.
onSent
public void onSent(SendTransaction trans)
Called when a transaction is sent.
onSent
public void onSent(int size)
Called when data has been sent.
onReceived
public void onReceived(ReadTransaction trans)
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
public void setClosed(SessionConnectionStatistics.State reason)
Called when the connection is closed. An error is logged if current state is not INITIALIZING or CONNECTED.- Parameters:
reason- The reason state.
setReconnected
public void setReconnected(SessionStatistics other)
Called when the connection is re-connected. An error is logged if current state is not PAUSED or BROKEN.
getCurrentState
public SessionConnectionStatistics.State getCurrentState()
Gets the current state.
onPong
public void onPong(long time)
Called when a pong transaction is received.
setHeartBeatDuration
public void setHeartBeatDuration(long duration)
Sets the last web socket heart-beat duration (the PING-PONG message exchange in milliseconds).
getCurrentStatitics
public SessionConnectionStatistics getCurrentStatitics()
Gets the current connection statistics.
getHistory
public SessionConnectionStatistics[] getHistory()
Gets the history of connection statistics.- Returns:
- The array of statistics for the history, or null if none is available.