You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Noel J. Bergman" <no...@devtech.com> on 2003/05/19 17:03:48 UTC

Redirect - thread safety and non-static values

> I think (unless I'm missing something) that there
> is a bug in Redirect, that I hopefully fixed in the attached code
> (search for "multithreading"): in case of "non static"
> parameters, the mailet is using in service(Mail) some instance
> variables (for example "replyTo") that would be shared by the
> different spoolmanager threads, causing problems specially in a
> multiprocessor machine; I changed to the use of new variables
> local to the method.

I believe that you are correct.  The member variables in the non-static
state would be re-initialized for each call into service(), so if there were
multiple messages being redirected in separate spool threads, they would
corrupt each other's settings.  I have not looked at your code, yet, but I
believe that your analysis is correct.

A side-effect of correcting the thread safety problem should change the
behavior of the static vs dynamic settings, as noted for bugzilla 17805,
because the instance members would have ONLY static values, and would not be
initialized as a by-product of service().

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org