use of co.paralleluniverse.galaxy.StoreTransaction in project quasar by puniverse.
the class GlxGlobalRegistry method tryGetActor0.
private CacheEntry tryGetActor0(final String rootName) throws SuspendExecution, RuntimeException {
final Store store = grid.store();
final StoreTransaction txn = store.beginTransaction();
try {
try {
final long root = store.getRoot(rootName, txn);
final byte[] buf = store.gets(root, txn);
if (buf == null) {
LOG.debug("Store returned null for root {}", rootName);
return null;
}
final long version = store.getVersion(root);
store.commit(txn);
LOG.debug("Store returned a buffer ({} bytes) for root {}", buf.length, rootName);
if (buf.length == 0)
// TODO: Galaxy should return null
return null;
ActorRef<?> actor = deserActor(rootName, buf);
return new CacheEntry(actor, root, version);
} catch (TimeoutException e) {
LOG.error("Getting actor {} failed due to timeout", rootName);
store.rollback(txn);
store.abort(txn);
throw new RuntimeException("Actor discovery failed");
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
Aggregations