log.debug("Invoking pre-action event handler for event {}: {}", event, preHandler);
try {
preHandler.invoke(moduleObject, log);
} catch (Exception e) {
throw new ActionEventException("Failed to execute pre-action event handler: " + preHandler, e);
}
}
ActionEventException exception = null;
try {
// 执行event handler
log.debug("Invoking action event handler for event {}: {}", event, handler);
try {
handler.invoke(moduleObject, log);
} catch (Exception e) {
exception = new ActionEventException("Failed to execute action event handler: " + handler, e);
}
} finally {
// 执行postHandler
if (postHandler != null) {
log.debug("Invoking post-action event handler for event {}: {}", event, postHandler);
try {
postHandler.invoke(moduleObject, log);
} catch (Exception e) {
if (exception == null) {
exception = new ActionEventException("Failed to execute post-action event handler: "
+ postHandler, e);
}
}
}
}