Package org.apache.hadoop.hdfs.net
Class TcpPeerServer
java.lang.Object
org.apache.hadoop.hdfs.net.TcpPeerServer
- All Implemented Interfaces:
Closeable,AutoCloseable,PeerServer
-
Constructor Summary
ConstructorsConstructorDescriptionTcpPeerServer(int socketWriteTimeout, InetSocketAddress bindAddr, int backlogLength) Create a non-secure TcpPeerServer.TcpPeerServer(SecureDataNodeStarter.SecureResources secureResources) Create a secure TcpPeerServer. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.hdfs.net.Peeraccept()Listens for a connection to be made to this server and accepts it.voidclose()Free the resources associated with this peer server.intGet the receive buffer size of the PeerServer.voidsetReceiveBufferSize(int size) Set the receive buffer size of the PeerServer.toString()
-
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
Create a secure TcpPeerServer.- Parameters:
secureResources- Security resources.
-
-
Method Details
-
getStreamingAddr
- Returns:
- the IP address which this TcpPeerServer is listening on.
-
setReceiveBufferSize
Description copied from interface:PeerServerSet the receive buffer size of the PeerServer.- Specified by:
setReceiveBufferSizein interfacePeerServer- Parameters:
size- The receive buffer size.- Throws:
IOException
-
getReceiveBufferSize
Description copied from interface:PeerServerGet the receive buffer size of the PeerServer.- Specified by:
getReceiveBufferSizein interfacePeerServer- Returns:
- The receive buffer size.
- Throws:
IOException
-
accept
Description copied from interface:PeerServerListens for a connection to be made to this server and accepts it. The method blocks until a connection is made.- Specified by:
acceptin interfacePeerServer- 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
- Specified by:
getListeningStringin interfacePeerServer- Returns:
- A string representation of the address we're listening on.
-
close
Description copied from interface:PeerServerFree the resources associated with this peer server. This normally includes sockets, etc.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacePeerServer- Throws:
IOException- If there is an error closing the PeerServer
-
toString
-