When james is configured with many processors then the spooling processing
is really slow.
It takes a minimum of 1 minute per processor to fully spool a single email.
JDBCSpoolRepository has a 60 seconds wait, and the spool threads only
complete 1 processor and return the mail to the spool.
Looking at process() in the JamesSpoolManager I removed the "return" before
the catch and moved the last logging line inside the catch block.
I think this is conceptually correct but I would like to know your opinion
about.
Here is my modified process():
protected void process(MailImpl mail) {
while (true) {
String processorName = mail.getState();
if (processorName.equals(Mail.GHOST)) {
//This message should disappear
return;
}
try {
LinearProcessor processor
= (LinearProcessor)processors.get(processorName);
if (processor == null) {
StringBuffer exceptionMessageBuffer =
new StringBuffer(128)
.append("Unable to find processor ")
.append(processorName)
.append(" requested for processing of ")
.append(mail.getName());
String exceptionMessage = exceptionMessageBuffer.toString();
getLogger().debug(exceptionMessage);
mail.setState(Mail.ERROR);
throw new MailetException(exceptionMessage);
}
StringBuffer logMessageBuffer = null;
if (getLogger().isDebugEnabled()) {
logMessageBuffer =
new StringBuffer(64)
.append("Processing ")
.append(mail.getName())
.append(" through ")
.append(processorName);
getLogger().debug(logMessageBuffer.toString());
}
processor.service(mail);
if (getLogger().isDebugEnabled()) {
logMessageBuffer =
new StringBuffer(128)
.append("Processed ")
.append(mail.getName())
.append(" through ")
.append(processorName);
getLogger().debug(logMessageBuffer.toString());
getLogger().debug("Result was " + mail.getState());
}
// removing this return could create loops in processing.
// btw this speed up processing.
// return;
} catch (Throwable e) {
// This is a strange error situation that shouldn't ordinarily
// happen
StringBuffer exceptionBuffer =
new StringBuffer(64)
.append("Exception in processor <")
.append(processorName)
.append(">");
getLogger().error(exceptionBuffer.toString(), e);
if (processorName.equals(Mail.ERROR)) {
// We got an error on the error processor...
// kill the message
mail.setState(Mail.GHOST);
mail.setErrorMessage(e.getMessage());
} else {
//We got an error... send it to the requested processor
if (!(e instanceof MessagingException)) {
//We got an error... send it to the error processor
mail.setState(Mail.ERROR);
}
mail.setErrorMessage(e.getMessage());
}
if (getLogger().isErrorEnabled()) {
StringBuffer logMessageBuffer =
new StringBuffer(128)
.append("An error occurred processing ")
.append(mail.getName())
.append(" through ")
.append(processorName);
getLogger().error(logMessageBuffer.toString());
getLogger().error("Result was " + mail.getState());
}
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]