protected Task<Object> performLocalInvocation(final Invocation invocation, final ObjectInvoker invoker, final LocalObjects.LocalObjectEntry target) { Task result = invoker.safeInvoke(target.getObject(), invocation.getMethodId(), invocation.getParams()); try { // must await to hold the execution serializer await(result); } catch (Throwable ex) { // handled bellow; } if (invocation.getCompletion() != null) { InternalUtils.linkFutures(result, invocation.getCompletion()); } return result; }
target -> performInvocation(ctx, invocation, entry, target))); if (invocation.getCompletion() != null) InternalUtils.linkFuturesOnError(result, invocation.getCompletion()); if (invocation.getCompletion() != null) invocation.getCompletion().completeExceptionally(new ObserverNotFound("Observer Missing. " + invocation.toString()));
private Task<Void> onActivate(HandlerContext ctx, final Invocation invocation) { // this must run serialized by the remote reference key. LocalObjects.LocalObjectEntry<Object> entry = objects.findLocalObjectByReference(invocation.getToReference()); if (entry == null) { objects.registerLocalObject(invocation.getToReference()); entry = objects.findLocalObjectByReference(invocation.getToReference()); } // queues the invocation final LocalObjects.LocalObjectEntry<Object> theEntry = entry; final Task result = entry.run(target -> performInvocation(ctx, invocation, theEntry, target)); if (invocation.getCompletion() != null) { InternalUtils.linkFuturesOnError(result, invocation.getCompletion()); } // yielding since we blocked the entry before running on activate (serialized execution) return Task.done(); }
if (invocation.getCompletion() != null) invocation.getCompletion().completeExceptionally(exception);
if (e != null) if (invocation.getCompletion() != null) invocation.getCompletion().completeExceptionally(e);
if (invocation.getCompletion() != null) InternalUtils.linkFutures(write, invocation.getCompletion());
if (invocation.getCompletion() != null) InternalUtils.linkFutures(invokeResult, invocation.getCompletion());