for (int i = 0; i < count; i++) {
Hook rawHook = hooks.get(i);
session.getLogger().debug("executing hook " + rawHook.getClass().getName());
long start = System.currentTimeMillis();
HookResult hRes = callHook(rawHook, session, parameters);
long executionTime = System.currentTimeMillis() - start;
if (rHooks != null) {
for (int i2 = 0; i2 < rHooks.size(); i2++) {
Object rHook = rHooks.get(i2);
session.getLogger().debug("executing hook " + rHook);
hRes = ((HookResultHook) rHook).onHookResult(session, hRes, executionTime, rawHook);
}
}
// call the core cmd if we receive a ok return code of the hook so no other hooks are executed
if ((hRes.getResult() & HookReturnCode.OK) == HookReturnCode.OK) {
final Response response = doCoreCmd(session, command, parameters);
if ((hRes.getResult() & HookReturnCode.DISCONNECT) == HookReturnCode.DISCONNECT) {
return new Response() {
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.Response#isEndSession()