public class Connection
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Connection.State
Simple enums for communicating connection states.
|
| Constructor and Description |
|---|
Connection(java.lang.String remoteHost,
int port,
boolean usePrivilegedPort) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
close()
This is called when the connection should be closed.
|
protected void |
connect()
If there is no current connection, start a new tcp connection asynchronously.
|
Connection.State |
getConnectionState()
Convenience getter method.
|
java.net.InetSocketAddress |
getRemoteAddress()
Convenience getter method.
|
protected void |
notifyAllPendingSenders(java.lang.String message)
Notify all the senders of all pending requests
|
protected void |
notifySender(java.lang.Integer xid,
Xdr response)
Update the response map with the response and notify the thread waiting for the
response.
|
Xdr |
sendAndWait(int timeout,
Xdr xdrRequest)
Send a RPC request and wait until a response is received or timeout.
|
protected void |
shutdown()
This is called when the application is shutdown or the channel is closed.
|
public Connection(java.lang.String remoteHost,
int port,
boolean usePrivilegedPort)
remoteHost - A unique name for the host to which the connection is being made.port - The remote host port being used for the connection.usePrivilegedPort - true, use a privileged port (below 1024)
for RPC communication.false, use any non-privileged port for RPC
communication.public java.net.InetSocketAddress getRemoteAddress()
public Connection.State getConnectionState()
public Xdr sendAndWait(int timeout, Xdr xdrRequest) throws RpcException
timeout - The timeout in seconds.xdrRequest - The generic RPC data and protocol-specific data.RpcExceptionprotected void connect()
throws RpcException
RpcExceptionprotected void shutdown()
protected void close()
protected void notifySender(java.lang.Integer xid,
Xdr response)
xid - response - protected void notifyAllPendingSenders(java.lang.String message)