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).

Regards,

Oliver Schoett


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to