Package com.iizix.comm.test
Class TransactionProcessor
- java.lang.Object
- com.iizix.comm.test.TransactionProcessor
 
- All Implemented Interfaces:
- TransactionCommListener,- WebSocketAcceptor
 - public class TransactionProcessor extends java.lang.Object implements WebSocketAcceptor, TransactionCommListener The transaction processor for inbound connections from WebSockets.- Author:
- Christopher Mindus
 
- Constructor Summary- Constructors - Constructor - Description - TransactionProcessor()
 - Method Summary- All Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - java.lang.Object- isRequestURIAccepted(IWebSocketComm comm, java.lang.String uri, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headerFields)Called to check if a request URI can be accepted.- void- onCommClosed(TransactionComm comm, int code, java.lang.String reason)Called when the communication link is closed.- void- onCommClosing(TransactionComm comm)Called when the communication link is closing.- void- onCommConnected(TransactionComm comm)Called 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, java.lang.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.
 
- Method Detail- isRequestURIAccepted- public java.lang.Object isRequestURIAccepted(IWebSocketComm comm, java.lang.String uri, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headerFields) Called to check if a request URI can be accepted.- Specified by:
- isRequestURIAcceptedin interface- WebSocketAcceptor
- Parameters:
- comm- The WebSocket communication instance.
- uri- The request URI, formatted as e.g. "/something/more.ws?query-params".
- headerFields- HTTP header fields.
- Returns:
- Object an object that is attached to the TransactionComm instance, or null if the URI is not accepted.
 
 - onCommConnected- public void onCommConnected(TransactionComm comm) Called when the communication link is connected.- Specified by:
- onCommConnectedin interface- TransactionCommListener
- Parameters:
- comm- The transaction communication instance.
 
 - onCommData- public void onCommData(TransactionComm comm, ReadTransaction trans, int size) Called when the communication link has received data.- Specified by:
- onCommDatain interface- TransactionCommListener
- Parameters:
- comm- The socket 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:
- onCommHeartBeatin 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:
- onCommTimeoutin 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:
- onCommErrorin interface- TransactionCommListener
- Parameters:
- comm- The socket communication instance.
- e- The exception.
 
 - onCommClosing- public void onCommClosing(TransactionComm comm) Called when the communication link is closing.- Specified by:
- onCommClosingin interface- TransactionCommListener
- Parameters:
- comm- The socket communication instance.
 
 - onCommClosed- public void onCommClosed(TransactionComm comm, int code, java.lang.String reason) Called when the communication link is closed.- Specified by:
- onCommClosedin interface- TransactionCommListener
- Parameters:
- comm- The socket communication instance.