Interface IClientInstanceListener

All Superinterfaces:
TransactionCommListener

public interface IClientInstanceListener extends TransactionCommListener
Interface used to listen to changes in client connection states.
Author:
Christopher Mindus
  • Method Details

    • 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, 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, String reason)
      Called when the communication link is closed.
      Specified by:
      onCommClosed in interface TransactionCommListener
      Parameters:
      comm - The transaction communication instance.
    • onCommConnected

      default void onCommConnected(TransactionComm comm)
      Called when the communication link is connected.
      Specified by:
      onCommConnected in interface TransactionCommListener
      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 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

      default void onCommHeartBeat(TransactionComm comm, long duration)
      Called when the communication link has received data.
      Specified by:
      onCommHeartBeat in interface TransactionCommListener
      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 interface TransactionCommListener
      Parameters:
      comm - The transaction communication instance.
      isReadTimeout - Flag indicating read timeout when true, false indicates write timeout.
    • onCommError

      default void onCommError(TransactionComm comm, Throwable e)
      Called when the communication link is closed.
      Specified by:
      onCommError in interface TransactionCommListener
      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 interface TransactionCommListener
      Parameters:
      comm - The transaction communication instance.