Class BasicTCP

All Implemented Interfaces:
ConnectionListener, Receiver, Lifecycle, DiagnosticsHandler.ProbeHandler
Direct Known Subclasses:
TCP, TCP_NIO2

public abstract class BasicTCP extends TP implements Receiver, ConnectionListener
Shared base class for TCP protocols
  • Field Details

    • reaper_interval

      protected long reaper_interval
    • conn_expire_time

      protected long conn_expire_time
    • recv_buf_size

      protected int recv_buf_size
    • send_buf_size

      protected int send_buf_size
    • sock_conn_timeout

      protected int sock_conn_timeout
    • peer_addr_read_timeout

      protected int peer_addr_read_timeout
    • max_length

      protected int max_length
    • tcp_nodelay

      protected boolean tcp_nodelay
    • linger

      protected int linger
    • use_acks

      protected boolean use_acks
    • client_bind_addr

      protected InetAddress client_bind_addr
    • client_bind_port

      protected int client_bind_port
    • defer_client_bind_addr

      protected boolean defer_client_bind_addr
    • log_details

      protected boolean log_details
    • enable_suspect_events

      protected boolean enable_suspect_events
    • num_suspect_events

      protected final LongAdder num_suspect_events
  • Constructor Details

    • BasicTCP

      protected BasicTCP()
  • Method Details

    • supportsMulticasting

      public boolean supportsMulticasting()
      Description copied from class: TP
      Whether hardware multicasting is supported
      Specified by:
      supportsMulticasting in class TP
    • getReaperInterval

      public long getReaperInterval()
    • setReaperInterval

      public BasicTCP setReaperInterval(long interval)
    • reaperInterval

      public BasicTCP reaperInterval(long interval)
    • getConnExpireTime

      public long getConnExpireTime()
    • setConnExpireTime

      public BasicTCP setConnExpireTime(long time)
    • getRecvBufSize

      public int getRecvBufSize()
    • setRecvBufSize

      public BasicTCP setRecvBufSize(int r)
    • getSendBufSize

      public int getSendBufSize()
    • setSendBufSize

      public BasicTCP setSendBufSize(int s)
    • getSockConnTimeout

      public int getSockConnTimeout()
    • setSockConnTimeout

      public BasicTCP setSockConnTimeout(int s)
    • getMaxLength

      public int getMaxLength()
    • setMaxLength

      public BasicTCP setMaxLength(int len)
    • getPeerAddrReadTimeout

      public int getPeerAddrReadTimeout()
    • setPeerAddrReadTimeout

      public BasicTCP setPeerAddrReadTimeout(int p)
    • tcpNodelay

      public boolean tcpNodelay()
    • tcpNodelay

      public BasicTCP tcpNodelay(boolean t)
    • getLinger

      public int getLinger()
    • setLinger

      public BasicTCP setLinger(int l)
    • useAcks

      public boolean useAcks()
    • useAcks

      public BasicTCP useAcks(boolean f)
    • getClientBindAddr

      public InetAddress getClientBindAddr()
    • setClientBindAddr

      public BasicTCP setClientBindAddr(InetAddress c)
    • getClientBindPort

      public int getClientBindPort()
    • setClientBindPort

      public BasicTCP setClientBindPort(int c)
    • deferClientBindAddr

      public boolean deferClientBindAddr()
    • deferClientBindAddr

      public BasicTCP deferClientBindAddr(boolean d)
    • logDetails

      public boolean logDetails()
    • logDetails

      public BasicTCP logDetails(boolean l)
    • enableSuspectEvents

      public boolean enableSuspectEvents()
    • enableSuspectEvents

      public BasicTCP enableSuspectEvents(boolean b)
    • init

      public void init() throws Exception
      Description copied from class: Protocol
      Called after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent.
      Specified by:
      init in interface Lifecycle
      Overrides:
      init in class TP
      Throws:
      Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the the channel constructor will throw an exception
    • sendUnicast

      public void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws Exception
      Description copied from class: TP
      Send a unicast to a member. Note that the destination address is a *physical*, not a logical address
      Specified by:
      sendUnicast in class TP
      Parameters:
      dest - Must be a non-null unicast address
      data - The data to be sent. This is not a copy, so don't modify it
      Throws:
      Exception
    • getInfo

      public String getInfo()
      Specified by:
      getInfo in class TP
    • printConnections

      public abstract String printConnections()
    • send

      public abstract void send(Address dest, byte[] data, int offset, int length) throws Exception
      Throws:
      Exception
    • retainAll

      public abstract void retainAll(Collection<Address> members)
    • resetStats

      public void resetStats()
      Overrides:
      resetStats in class TP
    • down

      public Object down(Event evt)
      Description copied from class: Protocol
      An event is to be sent down the stack. A protocol may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the protocol may need to add a header to it (or do nothing at all) before sending it down the stack using down_prot.down().
      Overrides:
      down in class TP
    • connectionClosed

      public void connectionClosed(Connection conn)
      Specified by:
      connectionClosed in interface ConnectionListener
    • connectionEstablished

      public void connectionEstablished(Connection conn)
      Specified by:
      connectionEstablished in interface ConnectionListener