voldemort.client.protocol.admin
Class AdminClient.RPCOperations

java.lang.Object
  extended by voldemort.client.protocol.admin.AdminClient.RPCOperations
Enclosing class:
AdminClient

public class AdminClient.RPCOperations
extends java.lang.Object

Encapsulates all the RPC helper methods


Constructor Summary
AdminClient.RPCOperations()
           
 
Method Summary
 java.util.List<java.lang.Integer> getAsyncRequestList(int nodeId)
          Retrieves a list of asynchronous request ids on the server.
 java.util.List<java.lang.Integer> getAsyncRequestList(int nodeId, boolean showComplete)
          Retrieves a list of asynchronous request ids on the server.
 AsyncOperationStatus getAsyncRequestStatus(int nodeId, int requestId)
          Get the status of an Async Operation running at (remote) node.
 void stopAsyncRequest(int nodeId, int requestId)
          To stop an asynchronous request on the particular node
 java.lang.String waitForCompletion(int nodeId, int requestId)
          Wait for async task at (remote) nodeId to finish completion, using exponential backoff to poll the task completion status.
 java.lang.String waitForCompletion(int nodeId, int requestId, long maxWait, java.util.concurrent.TimeUnit timeUnit)
          Wait for async task at (remote) nodeId to finish completion, using exponential backoff to poll the task completion status.
 java.lang.String waitForCompletion(int nodeId, int requestId, long maxWait, java.util.concurrent.TimeUnit timeUnit, AsyncOperationStatus higherStatus)
          Wait for async task at (remote) nodeId to finish completion, using exponential backoff to poll the task completion status.
 void waitForCompletion(int nodeId, java.lang.String key, java.lang.String value)
          Wait till the passed value matches with the metadata value returned by the remote node for the passed key.
 void waitForCompletion(int nodeId, java.lang.String key, java.lang.String value, long maxWait, java.util.concurrent.TimeUnit timeUnit)
          Wait till the passed value matches with the metadata value returned by the remote node for the passed key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdminClient.RPCOperations

public AdminClient.RPCOperations()
Method Detail

getAsyncRequestStatus

public AsyncOperationStatus getAsyncRequestStatus(int nodeId,
                                                  int requestId)
Get the status of an Async Operation running at (remote) node. If The operation is complete, then the operation will be removed from a list of currently running operations.

Parameters:
nodeId - Id on which the operation is running
requestId - Id of the operation itself
Returns:
The status of the operation

getAsyncRequestList

public java.util.List<java.lang.Integer> getAsyncRequestList(int nodeId)
Retrieves a list of asynchronous request ids on the server. Does not include the completed requests

Parameters:
nodeId - The id of the node whose request ids we want
Returns:
List of async request ids

getAsyncRequestList

public java.util.List<java.lang.Integer> getAsyncRequestList(int nodeId,
                                                             boolean showComplete)
Retrieves a list of asynchronous request ids on the server. Depending on the boolean passed also retrieves the completed requests

Parameters:
nodeId - The id of the node whose request ids we want
showComplete - Boolean to indicate if we want to include the completed requests as well
Returns:
List of async request ids

stopAsyncRequest

public void stopAsyncRequest(int nodeId,
                             int requestId)
To stop an asynchronous request on the particular node

Parameters:
nodeId - The id of the node on which the request is running
requestId - The id of the request to terminate

waitForCompletion

public java.lang.String waitForCompletion(int nodeId,
                                          int requestId,
                                          long maxWait,
                                          java.util.concurrent.TimeUnit timeUnit,
                                          AsyncOperationStatus higherStatus)
Wait for async task at (remote) nodeId to finish completion, using exponential backoff to poll the task completion status.

Logs the status at each status check if debug is enabled.

Parameters:
nodeId - Id of the node to poll
requestId - Id of the request to check
maxWait - Maximum time we'll keep checking a request until we give up. Pass in 0 or less to wait "forever".
timeUnit - Unit in which maxWait is expressed.
higherStatus - A higher level async operation object. If this waiting is being run another async operation this helps us propagate the status all the way up.
Returns:
description The final description attached with the response
Throws:
VoldemortException - if task failed to finish in specified maxWait time.

waitForCompletion

public java.lang.String waitForCompletion(int nodeId,
                                          int requestId,
                                          long maxWait,
                                          java.util.concurrent.TimeUnit timeUnit)
Wait for async task at (remote) nodeId to finish completion, using exponential backoff to poll the task completion status.

Logs the status at each status check if debug is enabled.

Parameters:
nodeId - Id of the node to poll
requestId - Id of the request to check
maxWait - Maximum time we'll keep checking a request until we give up
timeUnit - Unit in which maxWait is expressed.
Returns:
description The final description attached with the response
Throws:
VoldemortException - if task failed to finish in specified maxWait time.

waitForCompletion

public java.lang.String waitForCompletion(int nodeId,
                                          int requestId)
Wait for async task at (remote) nodeId to finish completion, using exponential backoff to poll the task completion status. Effectively waits forever.

Logs the status at each status check if debug is enabled.

Parameters:
nodeId - Id of the node to poll
requestId - Id of the request to check
Returns:
description The final description attached with the response
Throws:
VoldemortException - if task failed to finish in specified maxWait time.

waitForCompletion

public void waitForCompletion(int nodeId,
                              java.lang.String key,
                              java.lang.String value,
                              long maxWait,
                              java.util.concurrent.TimeUnit timeUnit)
Wait till the passed value matches with the metadata value returned by the remote node for the passed key.

Logs the status at each status check if debug is enabled.

Parameters:
nodeId - Id of the node to poll
key - metadata key to keep checking for current value
value - metadata value should match for exit criteria.
maxWait - Maximum time we'll keep checking a request until we give up. Pass in 0 or less to wait "forever".
timeUnit - Unit in which maxWait is expressed.

waitForCompletion

public void waitForCompletion(int nodeId,
                              java.lang.String key,
                              java.lang.String value)
Wait till the passed value matches with the metadata value returned by the remote node for the passed key. Effectively waits forever.

Logs the status at each status check if debug is enabled.

Parameters:
nodeId - Id of the node to poll
key - metadata key to keep checking for current value
value - metadata value should match for exit criteria.


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu