Class SessionTransMgr

    • Constructor Detail

      • SessionTransMgr

        public SessionTransMgr​(ITransactionProcessor processor)
        Creates a new session for a new transaction processor.
        Parameters:
        processor - The transaction processor.
    • Method Detail

      • isReconnectionInstance

        public static boolean isReconnectionInstance​(java.lang.String reconnectID,
                                                     java.lang.String from)
        Checks if it's a valid reconnection session instance for an existing transaction processor and attempts reconnection.
        Returns:
        The instance of the Session Manager, null if the reconnection instance is not available.
      • createReconnectionInstance

        public static SessionTransMgr createReconnectionInstance​(java.net.SocketAddress address,
                                                                 java.lang.String reconnectID,
                                                                 int nextSerialReconnect)
        Creates a reconnection session instance for an existing transaction processor and attempts reconnection.
        Returns:
        The instance of the Session Manager, null if the reconnection instance is not available.
      • assignTransactionComm

        public void assignTransactionComm​(TransactionComm comm)
        Assigns the created transaction communications instance.
      • getProcessor

        public ITransactionProcessor getProcessor()
        Gets the transaction processor for unpackaged transactions.
      • dispose

        public void dispose​(boolean doAbort)
        Dispose of this session by delegating it to the Session ID.
        Parameters:
        doAbort - Abort-flag, if true pending transaction are not sent.
      • getStatisticsSnapshot

        public SessionStatistics getStatisticsSnapshot()
        Gets the statistics as a snapshot.
      • getSession

        public SessionID getSession()
        Gets the session.
        Returns:
        The session.
      • getSessionID

        public java.lang.String getSessionID()
        Gets the session identifier.
        Returns:
        The session identifier, or null if disposed of.
      • doDispose

        public void doDispose​(boolean doAbort)
        Called when the session ID has been disposed of by a call to its dispose method.
        Specified by:
        doDispose in interface ISessionTransMgr
        Parameters:
        doAbort - Abort-flag, if true pending transaction are not sent.
      • isConnected

        public boolean isConnected()
        Checks if current session is connected. Be careful, do not forget that a connection can become isConnected()==false when paused!
      • isDisconnected

        public boolean isDisconnected()
        Checks if current session is connected. Be careful, do not forget that a connection can become isConnected()==false when paused!
      • isPaused

        public boolean isPaused()
        Checks if current session is connected. Be careful, do not forget that a connection can become isConnected()==false when paused!
      • doPause

        public void doPause()
        Requests a pause of the session from the server.
      • onCommData

        public void onCommData​(TransactionComm comm,
                               ReadTransaction trans,
                               int size)
        Called when the communication link has received data.
        Specified by:
        onCommData in interface TransactionCommListener
        Parameters:
        comm - The transaction communication instance.
        trans - The transaction received.
        size - The size of the data received, as it may have been uncompressed.
      • onCommHeartBeat

        public void onCommHeartBeat​(TransactionComm comm,
                                    long duration)
        Called when a heart-beat frame is received.
        Specified by:
        onCommHeartBeat in interface TransactionCommListener
        Parameters:
        comm - The transaction communication instance.
        duration - Duration of the PING-PONG message exchange in milliseconds.
      • onCommTimeout

        public void onCommTimeout​(TransactionComm comm,
                                  boolean isReadTimeout)
        Called when the communication link has timed out on a read or write operation.
        Specified by:
        onCommTimeout in interface TransactionCommListener
        Parameters:
        comm - The transaction communication instance.
        isReadTimeout - Flag indicating read timeout when true, false indicates write timeout.
      • onCommError

        public void onCommError​(TransactionComm comm,
                                java.lang.Throwable e)
        Called when the communication link is closed.
        Specified by:
        onCommError in interface TransactionCommListener
        Parameters:
        comm - The transaction communication instance.
        e - The exception.
      • onCommClosed

        public void onCommClosed​(TransactionComm comm,
                                 int code,
                                 java.lang.String reason)
        Called when the communication link is closed.
        Specified by:
        onCommClosed in interface TransactionCommListener
        Parameters:
        comm - The transaction communication instance.
      • requestPingPong

        public void requestPingPong()
        Requests a ping-pong transaction.
      • sendTransaction

        public boolean sendTransaction​(SendTransaction trans)
        Send a transaction to the client, assigning the transaction serial and processing statistics.
        Parameters:
        trans - The transaction to send.
        Returns:
        true for success, false for failure.
      • closeClientAuthenticationInfo

        public void closeClientAuthenticationInfo​(java.lang.String info)
        Sends a close management transaction indicating the User Name or Password were incorrect.
        Parameters:
        info - The information string.
      • closeClient

        public void closeClient​(java.lang.String msg)
        Sends a close management transaction with an message in HTML format for the close reason.
        Parameters:
        msg - The close reason in HTML format.