use of co.paralleluniverse.galaxy.TimeoutException 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);
}
}
use of co.paralleluniverse.galaxy.TimeoutException in project quasar by puniverse.
the class GlxRemoteChannel method send.
private static void send(Object message, GlxGlobalChannelId id) throws SuspendExecution {
LOG.debug("sent {}", message);
try {
if (id.isGlobal()) {
final long ref = id.getAddress();
if (message instanceof Streamable) {
getStore().send(ref, (Streamable) message);
} else {
final byte[] buf = Serialization.getInstance().write(message);
getStore().send(ref, buf);
}
} else {
final short node = (short) id.getAddress();
if (message instanceof Streamable) {
getMessenger().send(node, (Long) id.getTopic(), (Streamable) message);
} else {
final byte[] buf = Serialization.getInstance().write(message);
getMessenger().send(node, (Long) id.getTopic(), buf);
}
}
} catch (TimeoutException e) {
throw new RemoteException(e);
}
}
Aggregations