protected void beforeInvoke(Invocation invocation, @Nullable Method method) { if (logger.isDebugEnabled()) { logger.debug("Invoking: {}.{}", invocation.getToReference().toString(), method != null ? method.getName() : invocation.getMethodId()); } }
public Task writeInvocation(final HandlerContext ctx, final Invocation invocation) throws Exception { LocalObjects.LocalObjectEntry localObjectEntry = objects.findLocalObjectByReference(invocation.getToReference()); if (localObjectEntry != null) { return scheduleLocalInvocation(localObjectEntry, invocation); } return ctx.write(invocation); }
@SuppressWarnings("unchecked") protected void onInvoke(final HandlerContext ctx, final Invocation invocation) { LocalObjects.LocalObjectEntry localObjectEntry = objects.findLocalObjectByReference(invocation.getToReference()); if (localObjectEntry != null) { scheduleLocalInvocation(localObjectEntry, invocation); return; } ctx.fireRead(invocation); }
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(); }
/** * @return the result of the method called */ @SuppressWarnings("unchecked") public Task scheduleLocalInvocation(final LocalObjects.LocalObjectEntry<Object> localObjectEntry, final Invocation invocation) { ObjectInvoker invoker = runtime.getInvoker(RemoteReference.getInterfaceId(invocation.getToReference())); return localObjectEntry.run(target -> performLocalInvocation(invocation, invoker, target) ); }
private Task onInvocation(final HandlerContext ctx, final Invocation invocation) final RemoteReference toReference = invocation.getToReference(); final NodeAddress localAddress = getNodeAddress(); return locateActor(invocation.getToReference(), true) .whenComplete((r, e) -> { if (e != null)
final RemoteReference toReference = invocation.getToReference(); if (toReference instanceof NodeCapabilities)
public Task<?> writeInvocation(final HandlerContext ctx, Invocation invocation) { final Addressable toReference = invocation.getToReference(); final RemoteReference<?> actorReference = (RemoteReference<?>) toReference; final NodeAddress toNode = invocation.getToNode(); Map<String, Object> actualHeaders = null; if (invocation.getHeaders() != null) { actualHeaders = new HashMap<>(); actualHeaders.putAll(invocation.getHeaders()); } final Message message = new Message() .withMessageType(invocation.isOneWay() ? MessageDefinitions.ONE_WAY_MESSAGE : MessageDefinitions.REQUEST_MESSAGE) .withToNode(toNode) .withFromNode(invocation.getFromNode()) .withHeaders(actualHeaders) .withInterfaceId(actorReference._interfaceId()) .withMessageId(invocation.getMessageId()) .withMethodId(invocation.getMethodId()) .withObjectId(RemoteReference.getId(actorReference)) .withPayload(invocation.getParams()) .withReferenceAddress(invocation.getToReference().address); if (logger.isTraceEnabled()) { logger.trace("sending message to " + toReference); } return writeMessage(ctx, message); }
protected void onInvoke(final HandlerContext ctx, final Invocation invocation) LocalObjects.LocalObjectEntry localObjectEntry = objects.findLocalObjectByReference(invocation.getToReference()); if (localObjectEntry != null) .withToReference(invocation.getToReference()) .withMethod(invocation.getMethod()) .withOneWay(invocation.isOneWay())
private Task<?> cacheResponseInvoke(HandlerContext ctx, Invocation invocation) { final String parameterHash = generateParameterHash(invocation.getParams()); final Pair<Addressable, String> key = Pair.of(invocation.getToReference(), parameterHash); final Method method = invocation.getMethod(); Task<?> cached = get(method, key); if (cached == null || cached.isCompletedExceptionally() || cached.isCancelled()) { cached = ctx.write(invocation); put(method, key, cached); } return cached.thenApply((object) -> { if (!CloneHelper.needsCloning(object)) { return object; } return objectCloner.clone(object); }); }
protected Task<?> writeInvocation(final HandlerContext ctx, Invocation invocation) final RemoteReference<?> toReference = invocation.getToReference(); if (onlyIfActivateCache.isAnnotated(method))
@SuppressWarnings("unchecked") protected void onInvocation(final HandlerContext ctx, final Invocation invocation) final RemoteReference toReference = invocation.getToReference(); final LocalObjects.LocalObjectEntry<Object> entry = objects.findLocalObjectByReference(toReference); if (entry != null)