[jboss-jira] [JBoss JIRA] Created: (JBMESSAGING-1812) Thread.sleep() is called with lock held in class ServerManagement

Wendy Feng (JIRA) jira-events at lists.jboss.org
Wed Jun 30 01:57:46 EDT 2010


Thread.sleep() is called with lock held in class ServerManagement
-----------------------------------------------------------------

                 Key: JBMESSAGING-1812
                 URL: https://jira.jboss.org/browse/JBMESSAGING-1812
             Project: JBoss Messaging
          Issue Type: Bug
          Components: Tests and Performance
    Affects Versions: 2.0.0.beta4
            Reporter: Wendy Feng


ServerManagement has unefficient code as follow: 

 public static synchronized void kill(int i) throws Exception
   {
      ...
         try
         {
            while (true)
            {
               server.ping();
               log.debug("server " + i + " still alive ...");
               Thread.sleep(100);
            }
         }
         catch (Throwable e)
         {
            //Ok
         }

         Thread.sleep(300);

         log.info("server " + i + " killed and dead");
      }

   }

Since the kill() method has been synchronized, calling Thread.sleep() can not realease the resource to other waiting threads. It may cause poor performance or even deadlock. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list