DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25748>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25748 Synchronization issues in ThreadPool.java ------- Additional Comments From [EMAIL PROTECTED] 2003-12-24 20:32 ------- Briefly, worker threads in the ControlRunnable class execute a loop of the form: for // toRun, shouldRun, shouldTerminate are non-volatile instance variables synchronized(this) { if (!shouldRun && !shouldTerminate) wait(); } ... re-read shouldRun, shouldTerminate fetch job description from toRun perform work describec by toRun clear shouldRun, shouldTerminate, etc. Instead, I think it'd be safer to use code of the form for synchronized (this) { while (!shouldRun && !shouldTerminate) wait(); copy shouldRun, shouldTerminate, toRun etc into temporary auto auto variables _shouldRun, _shouldTerminate, _toRun, etc. clear shouldRun, shouldTerminate, etc. } check _shouldRun, _shouldTerminate perform work described by _toRun See Josh Bloch's "Effective Java" book, chapter 50, for details. In addition, running Bill Pugh's "BugFinder" on the class files might turn up other issues. We've encountered this bug during large application stability testing at Sun. Fixing the code (as described above) seemed to remedy the problem. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]