use of com.ms.silverking.cloud.dht.client.AsyncValueRetrieval in project SilverKing by Morgan-Stanley.
the class HelloCallbackDHT2 method asyncOperationUpdated.
@Override
public void asyncOperationUpdated(AsyncOperation asyncOperation) {
OperationState opState;
opState = asyncOperation.getState();
if (opState == OperationState.FAILED) {
System.out.printf("Operation failed: %s\n", asyncOperation.getClass());
} else if (opState == OperationState.INCOMPLETE || opState == OperationState.SUCCEEDED) {
if (asyncOperation instanceof AsyncValueRetrieval) {
AsyncValueRetrieval asyncValueRetrieval;
Map<String, String> values;
asyncValueRetrieval = (AsyncValueRetrieval) asyncOperation;
try {
values = asyncValueRetrieval.getLatestValues();
for (Map.Entry<String, String> entry : values.entrySet()) {
System.out.printf("Complete: %s\t=>\t%s\n", entry.getKey(), entry.getValue());
}
} catch (RetrievalException e) {
e.printStackTrace();
}
// System.out.printf("Incomplete keys: %d\n", asyncValueRetrieval.getIncompleteKeys().size());
} else {
System.out.printf("Operation incomplete: %s\n", asyncOperation.getClass());
}
if (opState == OperationState.SUCCEEDED) {
s.release();
}
} else {
s.release();
}
// System.out.printf("%s %s %s\n", Thread.currentThread().getName(), asyncOperation.getClass(), opState);
}
Aggregations