voldemort.server.protocol.admin
Class AsyncOperationService

java.lang.Object
  extended by voldemort.common.service.AbstractService
      extended by voldemort.server.protocol.admin.AsyncOperationService
All Implemented Interfaces:
VoldemortService

public class AsyncOperationService
extends AbstractService

Asynchronous job scheduler for admin service operations. TODO: requesting a unique id, then creating an operation with that id seems like a bad API design.


Constructor Summary
AsyncOperationService(SchedulerService scheduler, int cacheSize)
           
 
Method Summary
 java.lang.String getAllAsyncOperations()
           
 java.util.List<java.lang.Integer> getAsyncOperationList(boolean showCompleted)
          Get list of asynchronous operations on this node.
 java.util.List<java.lang.Integer> getMatchingAsyncOperationList(java.lang.String jobDescPattern, boolean showCompleted)
           
 AsyncOperationStatus getOperationStatus(int requestId)
           
 java.lang.String getStatus(int id)
           
 int getUniqueRequestId()
          Generate a unique request id
 boolean isComplete(int requestId)
          Is a request complete? If so, forget the operations
protected  void startInner()
           
 java.lang.String stopAsyncOperation(int requestId)
           
protected  void stopInner()
           
 void stopOperation(int requestId)
           
 void submitOperation(int requestId, AsyncOperation operation)
          Submit a operations.
 
Methods inherited from class voldemort.common.service.AbstractService
getType, isStarted, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncOperationService

public AsyncOperationService(SchedulerService scheduler,
                             int cacheSize)
Method Detail

submitOperation

public void submitOperation(int requestId,
                            AsyncOperation operation)
Submit a operations. Throw a run time exception if the operations is already submitted

Parameters:
operation - The asynchronous operations to submit
requestId - Id of the request

isComplete

public boolean isComplete(int requestId)
Is a request complete? If so, forget the operations

Parameters:
requestId - Id of the request
Returns:
True if request is complete, false otherwise

getStatus

public java.lang.String getStatus(int id)

getMatchingAsyncOperationList

public java.util.List<java.lang.Integer> getMatchingAsyncOperationList(java.lang.String jobDescPattern,
                                                                       boolean showCompleted)

getAllAsyncOperations

public java.lang.String getAllAsyncOperations()

getAsyncOperationList

public java.util.List<java.lang.Integer> getAsyncOperationList(boolean showCompleted)
Get list of asynchronous operations on this node. By default, only the pending operations are returned.

Parameters:
showCompleted - Show completed operations
Returns:
A list of operation ids.

getOperationStatus

public AsyncOperationStatus getOperationStatus(int requestId)

stopAsyncOperation

public java.lang.String stopAsyncOperation(int requestId)

stopOperation

public void stopOperation(int requestId)

getUniqueRequestId

public int getUniqueRequestId()
Generate a unique request id

Returns:
A new, guaranteed unique, request id

startInner

protected void startInner()
Specified by:
startInner in class AbstractService

stopInner

protected void stopInner()
Specified by:
stopInner in class AbstractService


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