[jboss-dev-forums] [Design of POJO Server] - Re: Strange classloading behavior -- thread stuck

adrian@jboss.org do-not-reply at jboss.com
Tue Feb 3 10:01:18 EST 2009


"bstansberry at jboss.com" wrote : "adrian at jboss.org" wrote : 
  |   | anonymous wrote : 
  |   |   | I don't think your second guess is correct? The one about the remove
  |   |   | being outside the synchronized block. The code is the same as JBoss4.x
  |   | 
  |   | That was more something I noticed that just looked wrong in general -- mutating an unguarded object. If it caused a problem though I'd expect it to be an IndexOutOfBoundsException because a thread lost a race to remove the last item.
  | 
  | I don't think there is a problem there (not just because it is the same as JBoss4 :-).
  | 
  | The list is a SynchronizedList and you only get to that code if you own the lock
  | and there is something to execute (notice the return inside the synchronized block
  | if the list is empty).
  | 
  | So other people can add to the list, but you can be sure there is at least one element
  | in it when you do the remove().

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206582#4206582

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206582



More information about the jboss-dev-forums mailing list