@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.IOException
public TcpPeerServer(SecureDataNodeStarter.SecureResources secureResources)
secureResources
- Security resources.public static Peer peerFromSocket(Socket socket) throws IOException
IOException
public static Peer peerFromSocketAndKey(Socket s, DataEncryptionKey key) throws IOException
IOException
public InetSocketAddress getStreamingAddr()
public void setReceiveBufferSize(int size) throws IOException
PeerServer
setReceiveBufferSize
in interface PeerServer
size
- The receive buffer size.IOException
public Peer accept() throws IOException, SocketTimeoutException
PeerServer
accept
in interface PeerServer
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.public String getListeningString()
getListeningString
in interface PeerServer
public void close() throws IOException
PeerServer
close
in interface Closeable
close
in interface AutoCloseable
close
in interface PeerServer
IOException
- If there is an error closing the PeerServerCopyright © 2013 Apache Software Foundation. All rights reserved.