@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; }