public static boolean dispatch(Object target, String subject, String senderAddress, Object args) { assert (subject != null); assert (target != null); Method handler = resolveHandler(target.getClass(), subject); if (handler == null) return false; try { handler.invoke(target, subject, senderAddress, args); } catch (IllegalArgumentException e) { s_logger.error("Unexpected exception when calling " + target.getClass().getName() + "." + handler.getName(), e); throw new RuntimeException("IllegalArgumentException when invoking event handler for subject: " + subject); } catch (IllegalAccessException e) { s_logger.error("Unexpected exception when calling " + target.getClass().getName() + "." + handler.getName(), e); throw new RuntimeException("IllegalAccessException when invoking event handler for subject: " + subject); } catch (InvocationTargetException e) { s_logger.error("Unexpected exception when calling " + target.getClass().getName() + "." + handler.getName(), e); throw new RuntimeException("InvocationTargetException when invoking event handler for subject: " + subject); } return true; }