Package com.iizix.comm.session
Class SessionTransMgr
java.lang.Object
com.iizix.comm.session.SessionTransMgr
- All Implemented Interfaces:
- GCloseCodes,- GManagementConstants,- ITransactionCreator,- ISessionStatistics,- ISessionTransMgr,- TransactionCommListener,- GConstants
public class SessionTransMgr extends Object implements ISessionTransMgr, TransactionCommListener, ITransactionCreator, GConstants, GManagementConstants, GCloseCodes
The Session Transaction Manager is used for keeping track of transaction that have been received or sent to a client on session basis so that a remote session may re-establish a broken communication link.
- Author:
- Christopher Mindus
- Field Summary- Fields inherited from interface com.iizix.comm.GCloseCodes- CC_APPMSG, CC_DISPOSED, CC_HISTORY_ERROR, CC_OCCUPIED, CC_PAUSE, CC_USERINFO- Fields inherited from interface com.iizix.GConstants- TRANS_ATOM, TRANS_BINARY_DATA, TRANS_BUSY, TRANS_CLIENT_LOCK, TRANS_CREATE, TRANS_DISPLAYTERMINAL, TRANS_DOWNLOAD_RESOURCES, TRANS_HOSTPRINT, TRANS_INIT, TRANS_INSTALL_RESOURCE, TRANS_LOG, TRANS_MANAGEMENT, TRANS_MESSAGE, TRANS_RELOAD, TRANS_REMOTE_CALL, TRANS_REMOTE_EVENT, TRANS_REMOTE_REPLY, TRANS_REMOVETERMINAL, TRANS_TERMINALUPDATE, TRANS_UPDATE- Fields inherited from interface com.iizix.comm.GManagementConstants- MT_CONNECTION, MT_DISPOSE_WHEN_CLOSED, MT_NEXT_SERIAL, MT_PING, MT_PONG, MT_PW, MT_RECONNECTION, MT_RESEND_TRANS
- Constructor SummaryConstructorsConstructorDescription- SessionTransMgr- (ITransactionProcessor processor) Creates a new session for a new transaction processor.
- Method SummaryModifier and TypeMethodDescription- voidAssigns the created transaction communications instance.- void- closeClient- (String msg) Sends a close management transaction with an message in HTML format for the close reason.- voidSends a close management transaction indicating the User Name or Password were incorrect.- static SessionTransMgr- createReconnectionInstance- (SocketAddress address, String reconnectID, int nextSerialReconnect) Creates a reconnection session instance for an existing transaction processor and attempts reconnection.Creates a transaction for processing normal transactions.- void- dispose- (boolean doAbort) Dispose of this session by delegating it to the Session ID.- void- doDispose- (boolean doAbort) Called when the session ID has been disposed of by a call to its dispose method.- void- doPause()Requests a pause of the session from the server.Gets the current state.Gets the transaction processor for unpackaged transactions.Gets the session.Gets the session identifier.Gets the statistics instance of the session.Gets the statistics as a snapshot.- booleanChecks if current session is connected.- booleanChecks if current session is connected.- boolean- isPaused()Checks if current session is connected.- static boolean- isReconnectionInstance- (String reconnectID, String from) Checks if it's a valid reconnection session instance for an existing transaction processor and attempts reconnection.- void- onCommClosed- (TransactionComm comm, int code, String reason) Called when the communication link is closed.- void- onCommClosing- (TransactionComm comm) Called when the communication link is closing.- voidCalled when the communication link is connected.- void- onCommData- (TransactionComm comm, ReadTransaction trans, int size) Called when the communication link has received data.- void- onCommError- (TransactionComm comm, Throwable e) Called when the communication link is closed.- void- onCommHeartBeat- (TransactionComm comm, long duration) Called when a heart-beat frame is received.- void- onCommTimeout- (TransactionComm comm, boolean isReadTimeout) Called when the communication link has timed out on a read or write operation.- voidRequests a ping-pong transaction.- boolean- sendTransaction- (SendTransaction trans) Send a transaction to the client, assigning the transaction serial and processing statistics.- Methods inherited from class java.lang.Object- clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait- Methods inherited from interface com.iizix.comm.session.ISessionStatistics- getLastConnectionTime, getProperties, getProperty, setProperty
- Constructor Details- SessionTransMgrCreates a new session for a new transaction processor.- Parameters:
- processor- The transaction processor.
 
 
- Method Details- isReconnectionInstanceChecks 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.
 
- createReconnectionInstancepublic static SessionTransMgr createReconnectionInstance- (SocketAddress address, 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.
 
- assignTransactionCommAssigns the created transaction communications instance.
- getProcessorGets the transaction processor for unpackaged transactions.
- getSessionStatisticsGets the statistics instance of the session.- Specified by:
- getSessionStatisticsin interface- ISessionStatistics
- Returns:
- The SessionStatistics instance.
 
- disposepublic 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.
 
- getStatisticsSnapshotGets the statistics as a snapshot.
- getSessionGets the session.- Returns:
- The session.
 
- getSessionIDGets the session identifier.- Returns:
- The session identifier, or null if disposed of.
 
- doDisposepublic void doDispose- (boolean doAbort) Called when the session ID has been disposed of by a call to its dispose method.- Specified by:
- doDisposein interface- ISessionTransMgr
- Parameters:
- doAbort- Abort-flag, if true pending transaction are not sent.
 
- getCurrentStateGets the current state.
- isConnectedpublic boolean isConnected()Checks if current session is connected. Be careful, do not forget that a connection can become- isConnected()==falsewhen paused!
- isDisconnectedpublic boolean isDisconnected()Checks if current session is connected. Be careful, do not forget that a connection can become- isConnected()==falsewhen paused!
- isPausedpublic boolean isPaused()Checks if current session is connected. Be careful, do not forget that a connection can become- isConnected()==falsewhen paused!
- doPausepublic void doPause()Requests a pause of the session from the server.
- createTransactionCreates a transaction for processing normal transactions.- Specified by:
- createTransactionin interface- ITransactionCreator
- Returns:
- The new Transactioninstance.
 
- onCommConnectedCalled when the communication link is connected.- Specified by:
- onCommConnectedin interface- TransactionCommListener
- Parameters:
- comm- The transaction communication instance.
 
- onCommDataCalled when the communication link has received data.- Specified by:
- onCommDatain 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.
 
- onCommHeartBeatCalled when a heart-beat frame is received.- Specified by:
- onCommHeartBeatin interface- TransactionCommListener
- Parameters:
- comm- The transaction communication instance.
- duration- Duration of the PING-PONG message exchange in milliseconds.
 
- onCommTimeoutCalled when the communication link has timed out on a read or write operation.- Specified by:
- onCommTimeoutin interface- TransactionCommListener
- Parameters:
- comm- The transaction communication instance.
- isReadTimeout- Flag indicating read timeout when true, false indicates write timeout.
 
- onCommErrorCalled when the communication link is closed.- Specified by:
- onCommErrorin interface- TransactionCommListener
- Parameters:
- comm- The transaction communication instance.
- e- The exception.
 
- onCommClosingCalled when the communication link is closing.- Specified by:
- onCommClosingin interface- TransactionCommListener
- Parameters:
- comm- The transaction communication instance.
 
- onCommClosedCalled when the communication link is closed.- Specified by:
- onCommClosedin interface- TransactionCommListener
- Parameters:
- comm- The transaction communication instance.
 
- requestPingPongpublic void requestPingPong()Requests a ping-pong transaction.
- sendTransactionSend 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.
 
- closeClientAuthenticationInfoSends a close management transaction indicating the User Name or Password were incorrect.- Parameters:
- info- The information string.
 
- closeClientSends a close management transaction with an message in HTML format for the close reason.- Parameters:
- msg- The close reason in HTML format.