Hey
> Oh, boy. I tried to avoid this be doing:
>
> Iterator it = new HashSet(objects.values()).iterator();
>
> However, it looks like the constructor for the HashSet uses an
> Iterator, and that's where it's failing. I'll try a clone or something
> instead. I want to avoid synchronizing the whole mess, since the DB pool
> will be seeing heavy use...
I looked at the code, and yes that won't work well multithreaded. The proper
way to do it is to either do clones on every usage (SLOW!), or to clone and
add/remove on changes (FAST!). There is an article on this on JavaWorld in
the context of AWT event listeners. Same situation really.
So, whenever you want to change the "objects" set you should
* Copy it
* Make the change to the new copy
* Assign it to "objects"
/Rickard