Class RpcWrapper<S extends NfsRequestBase, T extends NfsResponseBase>
java.lang.Object
com.emc.ecs.nfsclient.rpc.RpcWrapper<S,T>
Wrapper for NFS Server RPC calls, to handle unmarshalling, retries, and status checking.
-
Constructor Summary
ConstructorsConstructorDescriptionRpcWrapper(String server, int port, int retryWait, int maximumRetries, int maximumRequestSize, int rpcTimeout) -
Method Summary
Modifier and TypeMethodDescriptionBasic RPC call functionality only.voidcallRpcChecked(S request, RpcResponseHandler<? extends T> responseHandler) Convenience wrapper for NFS RPC calls where the IP is determined by a byte[] key.voidcallRpcNaked(S request, T response) Make the call using the Request ip key to determine the IP address for communication.voidcallRpcNaked(S request, T response, String ipAddress) Make the call to a specified IP address.voidcallRpcWrapped(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.voidcallRpcWrapped(S request, RpcResponseHandler<? extends T> responseHandler, String ip) Make the wrapped call and unmarshall the returned Xdr to a response, using the givenip.chooseIP(byte[] key) Select an IP address to use for communication, based on thekeyandpolicy.voidsetPort(int port) Reset the port as necessary - used if the port changes.
-
Constructor Details
-
RpcWrapper
public RpcWrapper(String server, int port, int retryWait, int maximumRetries, int maximumRequestSize, int rpcTimeout) - Parameters:
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.
-
-
Method Details
-
setPort
public void setPort(int port) Reset the port as necessary - used if the port changes.- Parameters:
port- The port on the remote server being used for this communication.
-
callRpcWrapped
public void callRpcWrapped(S request, RpcResponseHandler<? extends T> responseHandler) throws IOException Make the wrapped call and unmarshall the returned Xdr to a response, getting the IP key from the request. If an RPC Exception is being thrown, and retries remain, then log the exception and retry.- Parameters:
request- The request to send.responseHandler- A response handler.- Throws:
IOException
-
callRpcWrapped
public void callRpcWrapped(S request, RpcResponseHandler<? extends T> responseHandler, String ip) throws IOException Make the wrapped call and unmarshall the returned Xdr to a response, using the givenip. If an RPC Exception is being thrown, and retries remain, then log the exception and retry.- Parameters:
request- The request to send.responseHandler- A response handler.ip- The IP address to use for communication.- Throws:
IOException
-
callRpcChecked
public void callRpcChecked(S request, RpcResponseHandler<? extends T> responseHandler) throws IOException Convenience wrapper for NFS RPC calls where the IP is determined by a byte[] key. This method just determines the IP address and calls the basic method.- Parameters:
request- The request to send.responseHandler- A response handler.- Throws:
IOException
-
callRpcNaked
Make the call using the Request ip key to determine the IP address for communication.- Parameters:
request- The request to send.response- A response to hold the returned data.- Throws:
IOException
-
callRpcNaked
Make the call to a specified IP address.- Parameters:
request- The request to send.response- A response to hold the returned data.ipAddress- The IP address to use for communication.- Throws:
RpcException
-
callRpc
Basic RPC call functionality only.- Parameters:
serverIP- The endpoint of the server being called.xdrRequest- The Xdr data for the request.usePrivilegedPort-- If
true, use a privileged local port (below 1024) for RPC communication. - If
false, use any non-privileged local port for RPC communication.
- If
- Returns:
- The Xdr data for the response.
- Throws:
RpcException
-
chooseIP
Select an IP address to use for communication, based on thekeyandpolicy.- Parameters:
key- The key to use when selecting an IP address.- Returns:
- The IP address to use for communication.
- Throws:
IOException
-