[jboss-cvs] JBoss Messaging SVN: r3640 - in trunk/src/main/org/jboss: messaging/deployers and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 29 06:33:40 EST 2008


Author: ataylor
Date: 2008-01-29 06:33:39 -0500 (Tue, 29 Jan 2008)
New Revision: 3640

Modified:
   trunk/src/main/org/jboss/jms/jndi/JNDIObjectDeployer.java
   trunk/src/main/org/jboss/messaging/deployers/Deployer.java
   trunk/src/main/org/jboss/messaging/deployers/DeploymentManager.java
Log:
unregister deployables so thread can be DeploymentManager Thread can be stopped

Modified: trunk/src/main/org/jboss/jms/jndi/JNDIObjectDeployer.java
===================================================================
--- trunk/src/main/org/jboss/jms/jndi/JNDIObjectDeployer.java	2008-01-29 03:15:27 UTC (rev 3639)
+++ trunk/src/main/org/jboss/jms/jndi/JNDIObjectDeployer.java	2008-01-29 11:33:39 UTC (rev 3640)
@@ -104,9 +104,9 @@
    /**
     * lifecycle method
     */
-   public void stop()
+   public void stop() throws Exception
    {
-
+      DeploymentManager.getInstance().unregisterDeployable(this);   
    }
 
    /**

Modified: trunk/src/main/org/jboss/messaging/deployers/Deployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/deployers/Deployer.java	2008-01-29 03:15:27 UTC (rev 3639)
+++ trunk/src/main/org/jboss/messaging/deployers/Deployer.java	2008-01-29 11:33:39 UTC (rev 3640)
@@ -215,10 +215,11 @@
             }
             catch (Exception e)
             {
-               log.warn("problem deploying " + node, e);
+               log.warn("problem undeploying " + node, e);
             }
          }
       }
+      DeploymentManager.getInstance().unregisterDeployable(this);  
    }
 
    /**

Modified: trunk/src/main/org/jboss/messaging/deployers/DeploymentManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/deployers/DeploymentManager.java	2008-01-29 03:15:27 UTC (rev 3639)
+++ trunk/src/main/org/jboss/messaging/deployers/DeploymentManager.java	2008-01-29 11:33:39 UTC (rev 3640)
@@ -51,6 +51,7 @@
    private static ArrayList<URL> toUndeploy = new ArrayList<URL>();
    //the list of URL's to redeploy if changed
    private static ArrayList<URL> toRedeploy = new ArrayList<URL>();
+   private static ScheduledExecutorService scheduler;
 
    //we want to use a singleton
    private DeploymentManager()
@@ -78,11 +79,9 @@
          }
 
          // Get the scheduler
-         ScheduledExecutorService scheduler =
-                 Executors.newSingleThreadScheduledExecutor();
+         scheduler = Executors.newSingleThreadScheduledExecutor();
 
          scheduler.scheduleAtFixedRate(singleton, 10, 5, TimeUnit.SECONDS);
-
       }
       return singleton;
    }
@@ -146,6 +145,15 @@
       }
    }
 
+   public void unregisterDeployable(Deployable deployable)
+   {
+      deployables.remove(deployable);
+      if(deployables.size() == 0)
+      {
+         scheduler.shutdown();
+         scheduler = null;
+      }
+   }
    /**
     * called by the ExecutorService every n seconds
     */




More information about the jboss-cvs-commits mailing list