Class LoadBalancer.SocketHandler

java.lang.Object
com.tangosol.util.Base
com.tangosol.util.Daemon
com.tangosol.net.LoadBalancer.SocketHandler
All Implemented Interfaces:
Guardable, Runnable
Direct Known Subclasses:
LoadBalancer.RequestHandler, LoadBalancer.ResponseHandler
Enclosing class:
LoadBalancer

public abstract static class LoadBalancer.SocketHandler extends Daemon
A SocketHandler is an abstract daemon thread.
  • Field Details

    • m_abBuf

      protected byte[] m_abBuf
      The buffer to use for reading from a stream.
  • Constructor Details

    • SocketHandler

      public SocketHandler(String sName)
      Construct a SocketHandler with a given daemon thread name.
  • Method Details

    • run

      public abstract void run()
      Processing loop for the SocketHandler.
      Specified by:
      run in interface Runnable
      Specified by:
      run in class Daemon
    • process

      protected void process(Socket socketIn, Socket socketOut) throws IOException
      Process the transfer of data from one socket to another.
      Parameters:
      socketIn - the socket to read from
      socketOut - the socket to write to
      Throws:
      IOException
    • copy

      protected void copy(InputStream streamIn, OutputStream streamOut, byte[] abBuf) throws IOException
      Process the transfer of data from one stream to another.
      Parameters:
      streamIn - the stream to read from
      streamOut - the stream to write to
      abBuf - the byte array to use as a buffer to read into and write from
      Throws:
      IOException
    • ensureBuffer

      protected byte[] ensureBuffer(Socket socket)
      Return the existing buffer, if there is one, or create one to use for reading from the passed socket.
      Parameters:
      socket - the socket that the buffer will be used to read from
      Returns:
      a byte array to use as a read buffer