Class SessionStatistics


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

      • SessionStatistics

        public SessionStatistics()
        Creates a new instance for the Session Transaction Manager.
    • 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.
      • 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).
      • getHistory

        public SessionConnectionStatistics[] getHistory()
        Gets the history of connection statistics.
        Returns:
        The array of statistics for the history, or null if none is available.