tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Schoett <>
Subject Re: jvm cowardly refuses to print a thread dump
Date Fri, 05 Dec 2008 08:50:41 GMT
Martin Gainty wrote:
> so the solution is put all updates/inserts to the arraylist into a synchronized method?

You must synchronize all read and write methods, because nothing may run 
in parallel with a write method, and so read methods must be prevented 
from executing if a write method runs already.

The only exception is if you can ensure that the ArrayList is read-only 
at some point in your program (e. g., after a setup phase).

Arguing that the size() function cannot loop does not help, because the 
size function could be called internally in an infinite loop (this would 
be visible in the call stack).


Oliver Schoett

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message