/** * 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); } }
/** * 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); } }