Пример #1
0
 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(), null);
     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();
 }