@InterfaceAudience.Private public class TcpPeerServer extends Object implements PeerServer
| Constructor and Description |
|---|
TcpPeerServer(int socketWriteTimeout,
InetSocketAddress bindAddr)
Create a non-secure TcpPeerServer.
|
TcpPeerServer(SecureDataNodeStarter.SecureResources secureResources)
Create a secure TcpPeerServer.
|
| Modifier and Type | Method and Description |
|---|---|
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() |
InetSocketAddress |
getStreamingAddr() |
static Peer |
peerFromSocket(Socket socket) |
static Peer |
peerFromSocketAndKey(Socket s,
DataEncryptionKey key) |
void |
setReceiveBufferSize(int size)
Set the receive buffer size of the PeerServer.
|
String |
toString() |
public TcpPeerServer(int socketWriteTimeout,
InetSocketAddress bindAddr)
throws IOException
socketWriteTimeout - The Socket write timeout in ms.bindAddr - The address to bind to.IOExceptionpublic TcpPeerServer(SecureDataNodeStarter.SecureResources secureResources)
secureResources - Security resources.public static Peer peerFromSocket(Socket socket) throws IOException
IOExceptionpublic static Peer peerFromSocketAndKey(Socket s, DataEncryptionKey key) throws IOException
IOExceptionpublic InetSocketAddress getStreamingAddr()
public void setReceiveBufferSize(int size)
throws IOException
PeerServersetReceiveBufferSize in interface PeerServersize - The receive buffer size.IOExceptionpublic Peer accept() throws IOException, SocketTimeoutException
PeerServeraccept in interface PeerServerIOException - if an I/O error occurs when waiting for a
connection.SocketTimeoutException - if a timeout was previously set and
the timeout has been reached.public String getListeningString()
getListeningString in interface PeerServerpublic void close()
throws IOException
PeerServerclose in interface Closeableclose in interface AutoCloseableclose in interface PeerServerIOException - If there is an error closing the PeerServerCopyright © 2013 Apache Software Foundation. All rights reserved.