use of com.ms.silverking.cloud.dht.client.OperationException in project SilverKing by Morgan-Stanley.
the class GroupingSilverkingDB method insert.
@Override
public int insert(String table, String key, HashMap<String, ByteIterator> values) {
try {
// }
if (System.currentTimeMillis() == 0) {
syncNSP.put(key, values);
}
/**/
{
AsyncPut asyncPut;
// System.out.println("Waiting for: "+ key);
asyncPut = asyncNSP.put(key, values);
try {
asyncPut.waitForCompletion(30, TimeUnit.SECONDS);
if (asyncPut.getState() == OperationState.INCOMPLETE) {
System.out.println("Incomplete: " + key);
System.out.flush();
System.exit(-1);
}
} catch (OperationException e) {
PutException pe;
pe = (PutException) e;
if (pe.getFailureCause(key) == FailureCause.INVALID_VERSION) {
System.out.println("Ignoring INVALID_VERSION");
System.err.println("Ignoring INVALID_VERSION");
return 1;
} else {
throw new RuntimeException(pe);
}
}
}
// System.out.println("Done waiting for: "+ key);
return 0;
} catch (PutException pe) {
System.out.println("Key failed: " + key);
return 1;
}
}
Aggregations