Class SessionStatistics

java.lang.Object
com.iizix.comm.statistics.SessionStatistics

public class SessionStatistics extends Object
Statistics of a transaction session, including all connections.
Author:
Christopher Mindus
  • Constructor Details

    • SessionStatistics

      public SessionStatistics()
      Creates a new instance for the Session Transaction Manager.
  • Method Details

    • setProperty

      public void setProperty(String name, String value)
      Sets a property for the connection.
    • getProperty

      public String getProperty(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 Map<String,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 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

      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.