*/
public static boolean waitForAsyncOperationOnServer(VoldemortServer server,
String asyncOperationPattern,
long timeoutMs) {
long endTimeMs = System.currentTimeMillis() + timeoutMs;
AsyncOperationService service = server.getAsyncRunner();
List<Integer> matchingOperationIds = null;
// wait till the atleast one matching operation shows up
while(System.currentTimeMillis() < endTimeMs) {
matchingOperationIds = service.getMatchingAsyncOperationList(asyncOperationPattern,
true);
if(matchingOperationIds.size() > 0) {
break;
}
}
// now wait for those operations to complete
while(System.currentTimeMillis() < endTimeMs) {
List<Integer> completedOps = new ArrayList<Integer>(matchingOperationIds.size());
for(Integer op: matchingOperationIds) {
if(service.isComplete(op)) {
completedOps.add(op);
}
}
matchingOperationIds.removeAll(completedOps);
if(matchingOperationIds.size() == 0) {