}
};
// the command may be an asynchronous command, so we need to check
// for the @Async annotation.
Async async = command.getClass().getAnnotation(Async.class);
if (async == null) {
try {
wrappedComamnd.execute(context);
} catch(Throwable e) {
logger.log(Level.SEVERE,
adminStrings.getLocalString("adapter.exception",
"Exception in command execution : ", e), e);
report.setMessage(e.toString());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(e);
}
} else {
Thread t = new Thread() {
public void run() {
try {
wrappedComamnd.execute(context);
} catch (RuntimeException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
}
}
};
t.setPriority(async.priority());
t.start();
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
report.setMessage(
adminStrings.getLocalString("adapter.command.launch",
"Command {0} was successfully initiated asynchronously.",