Class LoadBalancerEndPoint

java.lang.Object
com.iizix.server.AbstractEndPoint
com.iizix.server.loadbalancer.LoadBalancerEndPoint
All Implemented Interfaces:
IServerWebSocketCommListener, ITransactionCreator, ITransactionSender, WebSocketCommListener, IEndPoint, IRootPropTransactionSender

public class LoadBalancerEndPoint extends AbstractEndPoint
The Load Balancer end point web socket connection: a member's connection on the principal (HUB-DESIGN.md 3.1, B-7b). The protocol - CHALLENGE, REGISTER, admission, the member table - is HubPrincipalConnection's and LoadBalancerHandler's; this class is the end point around them: the WebSocket, the property root, the heart-beat and the disposal.
Author:
Christopher Mindus
  • Method Details

    • onSessionConnected

      protected void onSessionConnected()
      Called upon connect: REGISTER must arrive within the deadline (HUB-DESIGN.md 13).
      Overrides:
      onSessionConnected in class AbstractEndPoint
    • onClientPropsCreated

      protected void onClientPropsCreated(PropCnr root)
      Called when the root is created from a transaction from the client. Override to perform some additional processing such as adding server environment, etc.
      Overrides:
      onClientPropsCreated in class AbstractEndPoint
    • onCommHeartBeat

      public void onCommHeartBeat(IWebSocketComm comm, long duration)
      Called when a heart-beat frame is received: the principal's measure of this link is kept per member (HUB-DESIGN.md 3.5).
      Specified by:
      onCommHeartBeat in interface WebSocketCommListener
      Overrides:
      onCommHeartBeat in class AbstractEndPoint
      Parameters:
      comm - The WebSocket communication instance.
      duration - Duration of the PING-PONG message exchange in milliseconds.
    • onCommError

      public void onCommError(IWebSocketComm comm, Throwable e)
      Called when the communication link failed: a member whose process died without a close frame is gone at once (HUB-DESIGN.md 13). The base class hard-closes the socket and disposes the end point, whoever failed the link: the peer, or the end point itself on a transaction it cannot read or a send that fails (CC-FIX-WEBSOCKET-F10-FOLLOWUP). This override, the hub's own repair since r20316 (measured live, CC-HUB-B7B-CHANNEL), repeats that disposal: its call is the second one and does nothing.
      Specified by:
      onCommError in interface WebSocketCommListener
      Overrides:
      onCommError in class AbstractEndPoint
      Parameters:
      comm - The WebSocket communication instance.
      e - The exception.
    • processQueuedTransaction

      protected final boolean processQueuedTransaction(int code, ReadTransaction trans)
      Processes queued transactions.
      Specified by:
      processQueuedTransaction in class AbstractEndPoint
      Parameters:
      code - The transaction code.
      trans - The transaction.
      Returns:
      true if the transaction has been processed, false otherwise.
    • dispose

      public boolean dispose()
      Disposes of the end point.
      Specified by:
      dispose in interface IEndPoint
      Overrides:
      dispose in class AbstractEndPoint
      Returns:
      true if disposed, false if already disposed of.