Class BioSender

java.lang.Object
org.apache.catalina.tribes.transport.AbstractSender
org.apache.catalina.tribes.transport.bio.BioSender
All Implemented Interfaces:
DataSender

public class BioSender extends AbstractSender
Send cluster messages with only one socket. Ack and keep Alive Handling is supported
Since:
5.5.16
Author:
Peter Rossbach
  • Field Details

    • sm

      protected static final StringManager sm
      The string manager for this package.
    • ackbuf

      protected final XByteBuffer ackbuf
  • Constructor Details

    • BioSender

      public BioSender()
  • Method Details

    • connect

      public void connect() throws IOException
      Connect other cluster member receiver
      Specified by:
      connect in interface DataSender
      Specified by:
      connect in class AbstractSender
      Throws:
      IOException - TODO Implement this org.apache.catalina.tribes.transport.DataSender method
      See Also:
    • disconnect

      public void disconnect()
      disconnect and close socket
      Specified by:
      disconnect in interface DataSender
      Specified by:
      disconnect in class AbstractSender
      See Also:
    • sendMessage

      public void sendMessage(byte[] data, boolean waitForAck) throws IOException
      Send message.
      Parameters:
      data - The data to send
      waitForAck - Wait for an ack
      Throws:
      IOException - An IO error occurred sending the message
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • openSocket

      protected void openSocket() throws IOException
      Open real socket and set time out when waitForAck is enabled is socket open return directly.
      Throws:
      IOException - Error opening socket
    • closeSocket

      protected void closeSocket()
      Close socket.
      See Also:
    • pushMessage

      protected void pushMessage(byte[] data, boolean reconnect, boolean waitForAck) throws IOException
      Push messages with only one socket at a time Wait for ack is needed and make auto retry when write message is failed. After sending error close and reopen socket again. After successful sending update stats WARNING: Subclasses must be very careful that only one thread call this pushMessage at once!!!
      Parameters:
      data - Data to send
      reconnect - Do a reconnect (close socket then reopen)
      waitForAck - Wait for an acknowledgement
      Throws:
      IOException - IO error writing data
      Since:
      5.5.10
      See Also:
    • waitForAck

      protected void waitForAck() throws IOException
      Wait for Acknowledgement from other server. FIXME Please, not wait only for three characters, better control that the wait ack message is correct.
      Throws:
      IOException - An IO error occurred