TcpPeerServer (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.net, class: TcpPeerServer

Package org.apache.hadoop.hdfs.net

# 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 Summary

  Constructors
  Constructor
  Description
  `TcpPeerServer(int socketWriteTimeout, InetSocketAddress bindAddr, int backlogLength)`
  Create a non-secure TcpPeerServer.
  `TcpPeerServer(SecureDataNodeStarter.SecureResources secureResources)`
  Create a secure TcpPeerServer.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `org.apache.hadoop.hdfs.net.Peer`
  `accept()`
  Listens for a connection to be made to this server and accepts it.
  `void`
  `close()`
  Free the resources associated with this peer server.
  `String`
  `getListeningString()`
  `int`
  `getReceiveBufferSize()`
  Get the receive buffer size of the PeerServer.
  `InetSocketAddress`
  `getStreamingAddr()`
  `void`
  `setReceiveBufferSize(int size)`
  Set the receive buffer size of the PeerServer.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## 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`