private String getInvokedClassAndMethodName(Message message) { if (message.getInterfaceId() != 0) { final Class clazz = DefaultClassDictionary.get().getClassById(message.getInterfaceId()); if (clazz != null) { final Method method = DefaultDescriptorFactory.get().getInvoker(clazz).getMethod(message.getMethodId()); return clazz.getSimpleName() + "." + method.getName(); } } return null; }
/** * Safely invokes a method, no exceptions ever thrown, and the returned Task is always non null. * * @param target the target actor or observer implementation * @param methodId the generated methodId * @param params array with the method parameters * @return a non null task. */ @SuppressWarnings("PMD.AvoidCatchingThrowable") public final Task<?> safeInvoke(T target, int methodId, Object[] params) { try { final Task<?> task = invoke(target, methodId, params); return task != null ? task : Task.done(); } catch (Throwable ex) { if (logger.isDebugEnabled()) { logger.debug("Failed invoking task", ex); } return Task.fromException(ex); } }
@SuppressWarnings("unchecked") protected Task<Object> doInvoke(final Stage runtime, final Invocation invocation, final LocalObjects.LocalObjectEntry entry, final LocalObjects.LocalObjectEntry target, final Method method, final Boolean reentrant, final ObjectInvoker invoker) { final long startTimeNanos = System.nanoTime(); beforeInvoke(invocation, method); final Task<Object> invokeResult = invoker.safeInvoke(target.getObject(), invocation.getMethodId(), invocation.getParams()); afterInvoke(startTimeNanos, invocation, method); invokeResult.whenComplete((o, throwable) -> taskComplete(startTimeNanos, invocation, method)); return invokeResult; }
if (clazz != null) final Method method = DefaultDescriptorFactory.get().getInvoker(clazz).getMethod(message.getMethodId()); strTarget = clazz.getSimpleName() + ":" + message.getObjectId() + "." + method.getName();
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; }
/** * Safely invokes a method, no exceptions ever thrown, and the returned Task is always non null. * * @param target the target actor or observer implementation * @param methodId the generated methodId * @param params array with the method parameters * @return a non null task. */ @SuppressWarnings("PMD.AvoidCatchingThrowable") public final Task<?> safeInvoke(T target, int methodId, Object[] params) { try { final Task<?> task = invoke(target, methodId, params); return task != null ? task : Task.done(); } catch (Throwable ex) { if (logger.isDebugEnabled()) { logger.debug("Failed invoking task", ex); } return Task.fromException(ex); } }
private long getResponseTimeoutMillis(final Message message) { final Class<?> clazz = DefaultClassDictionary.get().getClassById(message.getInterfaceId()); if (clazz != null) { final Method method = DefaultDescriptorFactory.get().getInvoker(clazz).getMethod(message.getMethodId()); final Timeout timeout = timeoutAnnotationCache.getAnnotation(method); if (timeout != null) { return timeout.timeUnit().toMillis(timeout.value()); } } return responseTimeoutMillis; }
final Task<Object> invokeResult = invoker.safeInvoke(target.getObject(), invocation.getMethodId(), invocation.getParams());
@Override public Message deserializeMessage(final BasicRuntime runtime, final byte[] payload) throws Exception { ensureInit(runtime); try { final Message message = mapper.readValue(payload, Message.class); // decode payload parameters according to the interface/method if (message.getPayload() != null && (message.getMessageType() == MessageDefinitions.ONE_WAY_MESSAGE || message.getMessageType() == MessageDefinitions.REQUEST_MESSAGE)) { final ObjectInvoker invoker = runtime.getInvoker(message.getInterfaceId()); final Method method = invoker.getMethod(message.getMethodId()); final Object[] args = castArgs(method.getGenericParameterTypes(), message.getPayload()); message.setPayload(args); } return message; } catch (Exception ex) { throw ex; } }
if (method == null) method = DefaultDescriptorFactory.get().getInvoker(RemoteReference.getInterfaceClass(toReference)).getMethod(invocation.getMethodId());
final Method method = invoker.getMethod(invocation.getMethodId()); final boolean reentrant = reentrantCache.isAnnotated(method);
@Override public Message deserializeMessage(final BasicRuntime runtime, final byte[] payload) throws Exception { ensureInit(runtime); try { final Message message = mapper.readValue(payload, Message.class); // decode payload parameters according to the interface/method if (message.getPayload() != null && (message.getMessageType() == MessageDefinitions.ONE_WAY_MESSAGE || message.getMessageType() == MessageDefinitions.REQUEST_MESSAGE)) { final ObjectInvoker invoker = runtime.getInvoker(message.getInterfaceId()); final Method method = invoker.getMethod(message.getMethodId()); final Object[] args = castArgs(method.getGenericParameterTypes(), message.getPayload()); message.setPayload(args); } return message; } catch (Exception ex) { throw ex; } }