public class RpcWrapper<S extends NfsRequestBase,T extends NfsResponseBase>
extends java.lang.Object
| Constructor and Description |
|---|
RpcWrapper(java.lang.String server,
int port,
int retryWait,
int maximumRetries,
int maximumRequestSize,
int rpcTimeout) |
| Modifier and Type | Method and Description |
|---|---|
Xdr |
callRpc(java.lang.String serverIP,
Xdr xdrRequest,
boolean usePrivilegedPort)
Basic RPC call functionality only.
|
void |
callRpcChecked(S request,
RpcResponseHandler<? extends T> responseHandler)
Convenience wrapper for NFS RPC calls where the IP is determined by a
byte[] key.
|
void |
callRpcNaked(S request,
T response)
Make the call using the Request ip key to determine the IP address for
communication.
|
void |
callRpcNaked(S request,
T response,
java.lang.String ipAddress)
Make the call to a specified IP address.
|
void |
callRpcWrapped(S request,
RpcResponseHandler<? extends T> responseHandler)
Make the wrapped call and unmarshall the returned Xdr to a response,
getting the IP key from the request.
|
void |
callRpcWrapped(S request,
RpcResponseHandler<? extends T> responseHandler,
java.lang.String ip)
Make the wrapped call and unmarshall the returned Xdr to a response,
using the given
ip. |
java.lang.String |
chooseIP(byte[] key)
Select an IP address to use for communication, based on the
key and policy. |
void |
setPort(int port)
Reset the port as necessary - used if the port changes.
|
public RpcWrapper(java.lang.String server,
int port,
int retryWait,
int maximumRetries,
int maximumRequestSize,
int rpcTimeout)
server - The remote server being called.port - The port on the remote server being used for this
communication.retryWait - The wait in milliseconds.maximumRetries - The maximum number of retries.maximumRequestSize - The maximum request size in bytes.rpcTimeout - The timeout in seconds.public void setPort(int port)
port - The port on the remote server being used for this
communication.public void callRpcWrapped(S request, RpcResponseHandler<? extends T> responseHandler) throws java.io.IOException
request - The request to send.responseHandler - A response handler.java.io.IOExceptionpublic void callRpcWrapped(S request, RpcResponseHandler<? extends T> responseHandler, java.lang.String ip) throws java.io.IOException
ip. If an RPC Exception is being thrown, and
retries remain, then log the exception and retry.request - The request to send.responseHandler - A response handler.ip - The IP address to use for communication.java.io.IOExceptionpublic void callRpcChecked(S request, RpcResponseHandler<? extends T> responseHandler) throws java.io.IOException
request - The request to send.responseHandler - A response handler.java.io.IOExceptionpublic void callRpcNaked(S request, T response) throws java.io.IOException
request - The request to send.response - A response to hold the returned data.java.io.IOExceptionpublic void callRpcNaked(S request, T response, java.lang.String ipAddress) throws RpcException
request - The request to send.response - A response to hold the returned data.ipAddress - The IP address to use for communication.RpcExceptionpublic Xdr callRpc(java.lang.String serverIP, Xdr xdrRequest, boolean usePrivilegedPort) throws RpcException
serverIP - The endpoint of the server being called.xdrRequest - The Xdr data for the request.usePrivilegedPort - true, use a privileged local port (below
1024) for RPC communication.false, use any non-privileged local port
for RPC communication.RpcExceptionpublic java.lang.String chooseIP(byte[] key)
throws java.io.IOException
key and policy.key - The key to use when selecting an IP address.java.io.IOException