[jboss-cvs] JBossAS SVN: r58165 - trunk/console/src/main/org/jboss/console/plugins

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 6 17:11:20 EST 2006


Author: genman
Date: 2006-11-06 17:11:19 -0500 (Mon, 06 Nov 2006)
New Revision: 58165

Modified:
   trunk/console/src/main/org/jboss/console/plugins/AOPLister.java
Log:
JBAS-2719 - Add Thread name to the AOP refresh thread


Modified: trunk/console/src/main/org/jboss/console/plugins/AOPLister.java
===================================================================
--- trunk/console/src/main/org/jboss/console/plugins/AOPLister.java	2006-11-06 21:31:36 UTC (rev 58164)
+++ trunk/console/src/main/org/jboss/console/plugins/AOPLister.java	2006-11-06 22:11:19 UTC (rev 58165)
@@ -53,8 +53,6 @@
  * As the number of MBeans is very big, we use a real Java class which is far
  * faster than beanshell
  *
- * @see <related>
- *
  * @author  <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
  * @version $Revision$
  *
@@ -855,57 +853,55 @@
 
    // org.jboss.console.plugins.helpers.PluginWrapper overrides -----------------------
    
-   /* (non-Javadoc)
-    * @see org.jboss.console.plugins.helpers.PluginWrapper#init(javax.servlet.ServletConfig)
-    */
    public void init(ServletConfig servletConfig) throws Exception
    {
-      // TODO Auto-generated method stub
       super.init(servletConfig);
-      final AOPLister lister = this;
-      
-      refreshPoller = new Thread(
-            new Runnable()
-            {
-               public void run()
-               {
-                  try
-                  {
-                     int advisorCount = 0;
-                     while (true)
-                     {
-                        int count = AspectManager.instance().getAdvisors().size();
-                        
-                        if (count != advisorCount)
-                        {
-                           lister.pm.regenerateAdminTree();
-                        }
-                        advisorCount = count;
-                        
-                        Thread.sleep(20000);
-                     }
-                  } 
-                  catch (InterruptedException e)
-                  {
-                     return;
-                  }
-               }
-            }
-      );
-      refreshPoller.setDaemon(true);
+      refreshPoller = new RefreshPoller();
       refreshPoller.start();
    }
+
+   class RefreshPoller extends Thread
+   {
+
+   	  final static int REFRESH_RATE = 20 * 1000;
+
+	  RefreshPoller()
+	  {
+		 setName("AOPListner");
+		 setDaemon(true);
+	  }
+   	 
+	  public void run()
+	  {
+	     try
+	     {
+			int advisorCount = 0;
+			while (!isInterrupted())
+			{
+			   int count = AspectManager.instance().getAdvisors().size();
+			   if (count != advisorCount)
+			   {
+				  pm.regenerateAdminTree();
+			   }
+			   advisorCount = count;
+			   
+			   Thread.sleep(REFRESH_RATE);
+			} 
+		 }
+	     catch (InterruptedException e)
+	     {
+			return;
+	     }
+	  }
+   } 
    
-   /* (non-Javadoc)
-    * @see org.jboss.console.plugins.helpers.PluginWrapper#destroy()
-    */
    public void destroy()
    {
       super.destroy();
       try
       {
-         // This join makes no sense since there is nothing breaking the thread
-         // refreshPoller.join();
+         refreshPoller.interrupt();
+         refreshPoller.join();
       } 
       catch (Exception e)
       {




More information about the jboss-cvs-commits mailing list