Class TcpPeerServer

java.lang.Object
org.apache.hadoop.hdfs.net.TcpPeerServer
All Implemented Interfaces:
Closeable, AutoCloseable, PeerServer

@Private public class TcpPeerServer extends Object implements PeerServer
  • Constructor Details

    • TcpPeerServer

      public TcpPeerServer(int socketWriteTimeout, InetSocketAddress bindAddr, int backlogLength) throws IOException
      Create a non-secure TcpPeerServer.
      Parameters:
      socketWriteTimeout - The Socket write timeout in ms.
      bindAddr - The address to bind to.
      backlogLength - The length of the tcp accept backlog
      Throws:
      IOException
    • TcpPeerServer

      public TcpPeerServer(SecureDataNodeStarter.SecureResources secureResources)
      Create a secure TcpPeerServer.
      Parameters:
      secureResources - Security resources.
  • Method Details

    • getStreamingAddr

      public InetSocketAddress getStreamingAddr()
      Returns:
      the IP address which this TcpPeerServer is listening on.
    • setReceiveBufferSize

      public void setReceiveBufferSize(int size) throws IOException
      Description copied from interface: PeerServer
      Set the receive buffer size of the PeerServer.
      Specified by:
      setReceiveBufferSize in interface PeerServer
      Parameters:
      size - The receive buffer size.
      Throws:
      IOException
    • getReceiveBufferSize

      public int getReceiveBufferSize() throws IOException
      Description copied from interface: PeerServer
      Get the receive buffer size of the PeerServer.
      Specified by:
      getReceiveBufferSize in interface PeerServer
      Returns:
      The receive buffer size.
      Throws:
      IOException
    • accept

      public org.apache.hadoop.hdfs.net.Peer accept() throws IOException, SocketTimeoutException
      Description copied from interface: PeerServer
      Listens for a connection to be made to this server and accepts it. The method blocks until a connection is made.
      Specified by:
      accept in interface PeerServer
      Throws:
      IOException - if an I/O error occurs when waiting for a connection.
      SocketTimeoutException - if a timeout was previously set and the timeout has been reached.
    • getListeningString

      public String getListeningString()
      Specified by:
      getListeningString in interface PeerServer
      Returns:
      A string representation of the address we're listening on.
    • close

      public void close() throws IOException
      Description copied from interface: PeerServer
      Free the resources associated with this peer server. This normally includes sockets, etc.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface PeerServer
      Throws:
      IOException - If there is an error closing the PeerServer
    • toString

      public String toString()
      Overrides:
      toString in class Object