Package com.iizix.comm.client
Interface IClientInstanceListener
- All Superinterfaces:
TransactionCommListener
public interface IClientInstanceListener extends TransactionCommListener
Interface used to listen to changes in client connection states.- Author:
- Christopher Mindus
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
onBinaryData(int id, java.lang.String descr, byte[] data)
Called when a transaction received binary data.default void
onCommClosed(TransactionComm comm, int code, java.lang.String reason)
Called when the communication link is closed.default void
onCommClosing(TransactionComm comm)
Called when the communication link is closing.default void
onCommConnected(TransactionComm comm)
Called when the communication link is connected.void
onCommConnected(TransactionComm comm, ClientProps root)
Called to process a transaction.default void
onCommData(TransactionComm comm, ReadTransaction trans, int size)
Called when the communication link has received data.default void
onCommError(TransactionComm comm, java.lang.Throwable e)
Called when the communication link is closed.default void
onCommHeartBeat(TransactionComm comm, long duration)
Called when the communication link has received data.default void
onCommTimeout(TransactionComm comm, boolean isReadTimeout)
Called when the communication link has timed out on a read or write operation.default boolean
processTransaction(int code, ReadTransaction mainTrans)
Called to process special transaction codes that are not processed by default.boolean
shouldLog(int level)
Called to check if the listener wishes to have an event logged.void
updateStates(TransactionComm comm)
Request of update connection and communication states.
Method Detail
shouldLog
boolean shouldLog(int level)
Called to check if the listener wishes to have an event logged.- Parameters:
level
- The log level of an event:{@link ILog#SEVERE}
(1) to{@link ILog#FINEST}
(7).
onCommConnected
void onCommConnected(TransactionComm comm, ClientProps root)
Called to process a transaction.- Parameters:
comm
- The communication interface.root
- The root communication property.
updateStates
void updateStates(TransactionComm comm)
Request of update connection and communication states.- Parameters:
comm
- The communication interface.
onBinaryData
void onBinaryData(int id, java.lang.String descr, byte[] data)
Called when a transaction received binary data.- Parameters:
id
- The ID of the reply local ID for error or success reply.descr
- Short description of the data.data
- The data received.
processTransaction
default boolean processTransaction(int code, ReadTransaction mainTrans)
Called to process special transaction codes that are not processed by default.Default transaction codes are:
{@link GConstants#TRANS_ATOM}
,{@link GConstants#TRANS_UPDATE}
,{@link GConstants#TRANS_REMOTE_EVENT}
,{@link GConstants#TRANS_BINARY_DATA}
.
- Parameters:
code
- The transaction code.mainTrans
- The main transaction.- Returns:
- true if processed, false if not processed.
onCommClosed
default void onCommClosed(TransactionComm comm, int code, java.lang.String reason)
Called when the communication link is closed.- Specified by:
onCommClosed
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.
onCommConnected
default void onCommConnected(TransactionComm comm)
Called when the communication link is connected.- Specified by:
onCommConnected
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.
onCommData
default void onCommData(TransactionComm comm, ReadTransaction trans, int size)
Called when the communication link has received data.- Specified by:
onCommData
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.trans
- The transaction received.size
- The size of the data received, as it may have been uncompressed.
onCommHeartBeat
default void onCommHeartBeat(TransactionComm comm, long duration)
Called when the communication link has received data.- Specified by:
onCommHeartBeat
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.duration
- The duration of the heart-beat in milliseconds.
onCommTimeout
default void onCommTimeout(TransactionComm comm, boolean isReadTimeout)
Called when the communication link has timed out on a read or write operation.- Specified by:
onCommTimeout
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.isReadTimeout
- Flag indicating read timeout when true, false indicates write timeout.
onCommError
default void onCommError(TransactionComm comm, java.lang.Throwable e)
Called when the communication link is closed.- Specified by:
onCommError
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.e
- The exception.
onCommClosing
default void onCommClosing(TransactionComm comm)
Called when the communication link is closing.- Specified by:
onCommClosing
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.