[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:34:04 EST 2009


"adrian at jboss.org" wrote : "adrian at jboss.org" wrote : 
  |   | The code is the same as JBoss4.x
  | 
  | There is one difference between 4.x and 5.x, which is the 4.x code won't loop forever
  | since it uses a for loop
  | 
  |   | JBoss 4.x
  |   | 
  |   |       int size = taskList != null ? taskList.size() : 0;
  |   |       synchronized( taskList )
  |   |       {
  |   |          for(int i = 0; i < size; i ++)
  |   | 
  |   | JBoss5.x
  |   | 
  |   |          synchronized (taskList)
  |   |          {
  |   |             while (taskList.isEmpty() == false)
  |   |             {
  |   | 
  | 
  | But using a for loop would just hide the problem. 
  | 
  | The thread on Trace2 still wouldn't be woken up because the other thread wouldn't
  | do the notification on its task list (it would still assign the task to the wrong thread).

One horrible thought is that JBoss4.x has the same problem but we haven't seen it
as clearly before because of the for loop. ;-(

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

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



More information about the jboss-dev-forums mailing list