User: d_jencks
  Date: 02/02/25 21:15:02

  Modified:    src/main/org/jboss/deployment MainDeployer.java
                        MainDeployerMBean.java
  Log:
  Changed shutdown procedure to first undeploy all packages, then stop, destroy, and 
remove all remaining registered mbeans
  
  Revision  Changes    Path
  1.9       +37 -31    jboss-system/src/main/org/jboss/deployment/MainDeployer.java
  
  Index: MainDeployer.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss-system/src/main/org/jboss/deployment/MainDeployer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MainDeployer.java 26 Feb 2002 01:37:21 -0000      1.8
  +++ MainDeployer.java 26 Feb 2002 05:15:02 -0000      1.9
  @@ -7,6 +7,7 @@
   
   package org.jboss.deployment;
   
  +
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.FileOutputStream;
  @@ -15,9 +16,9 @@
   import java.io.InputStream;
   import java.io.OutputStream;
   import java.net.JarURLConnection;
  -import java.net.URLConnection;
   import java.net.MalformedURLException;
   import java.net.URL;
  +import java.net.URLConnection;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Enumeration;
  @@ -25,6 +26,7 @@
   import java.util.HashSet;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.ListIterator;
   import java.util.Map;
   import java.util.Set;
   import java.util.StringTokenizer;
  @@ -37,7 +39,6 @@
   import javax.management.ObjectName;
   import org.jboss.system.ServiceMBeanSupport;
   import org.jboss.system.server.ServerConfigImplMBean;
  -
   import org.jboss.util.jmx.MBeanProxy;
   
   /**
  @@ -47,7 +48,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    */
   public class MainDeployer
      extends ServiceMBeanSupport
  @@ -104,6 +105,17 @@
         return period;
      }
      
  +   
  +   public boolean getScan() 
  +   { 
  +      return running; 
  +   }
  +
  +   public void setScan(boolean scan) 
  +   {
  +      running = scan; 
  +   }
  +
      /** 
       * Directory get set logic, these are "scanning" directories
       * on the local filesystem
  @@ -134,9 +146,7 @@
         if (!directories.contains(url)) {
            directories.add(url);
            
  -         if (log.isDebugEnabled()) {
  -            log.debug("Added directory scan "+url);
  -         }
  +         log.debug("Added directory scan "+url);
         }
      }
      
  @@ -191,7 +201,7 @@
      // ServiceMBeanSupport overrides ---------------------------------
      
      /**
  -    * Gets the ObjectName attribute of the AutoDeployer object
  +    * Gets the ObjectName attribute of the MainDeployer object
       *
       * @param server Description of Parameter
       * @param name Description of Parameter
  @@ -249,15 +259,22 @@
         running = false;
      }
   
  -   protected void destroyService()
  +   /**
  +    * The <code>shutdown</code> method undeploys all deployed packages in 
  +    * reverse order of their deployement.
  +    *
  +    */
  +   public void shutdown()
      {
  +      int deployCounter = 0;
         //undeploy everything in sight
  -      
  -      for (Iterator i = listDeployed().iterator(); i.hasNext(); )
  +      List copyDeployments = new ArrayList(deploymentsList);
  +      for (ListIterator i = copyDeployments.listIterator(copyDeployments.size()); 
i.hasPrevious(); )
         {
            try 
            {
  -            removeDeployment((DeploymentInfo)i.next()).cleanup(log);
  +            undeploy((DeploymentInfo)i.previous());
  +            deployCounter++;
            }
            catch (Exception e)
            {
  @@ -265,16 +282,7 @@
            } // end of try-catch
            
         } // end of for ()
  -   }
  -   
  -   public boolean getScan() 
  -   { 
  -      return running; 
  -   }
  -
  -   public void setScan(boolean scan) 
  -   {
  -      running = scan; 
  +      log.info("Undeployed " + deployCounter + " deployed packages");
      }
      
      /**
  @@ -502,9 +510,11 @@
         {
            return;
         }
  +      log.info("Starting deployment of package: " + deployment.url);
         init(deployment);
         create(deployment);
         start(deployment);
  +      log.info("Successfully completed deployment of package: " + deployment.url);
      }
      
   
  @@ -517,7 +527,7 @@
       */
      private void init(DeploymentInfo deployment) throws DeploymentException
      {
  -      log.info("Starting deployment (init step) of package at: " + deployment.url);
  +      log.debug("Starting deployment (init step) of package at: " + deployment.url);
         try 
         {
         
  @@ -534,11 +544,7 @@
            {
               deployment.deployer.init(deployment); 
            }
  -         else
  -         {
  -            log.debug("No deployer for package: " + deployment.url);
  -         } // end of else
  -         
  +        
   
            // create subdeployments as needed
            unpackSubPackages(deployment);
  @@ -583,7 +589,7 @@
       */
      private void create(DeploymentInfo deployment) throws DeploymentException
      {
  -      log.debug("create on deployment " + deployment.url);
  +      log.debug("create step for deployment " + deployment.url);
         try 
         {
            for (Iterator lt = 
sortDeployments(deployment.subDeployments).listIterator(); lt.hasNext();) 
  @@ -618,7 +624,7 @@
       */
      private void start(DeploymentInfo deployment) throws DeploymentException
      {
  -      log.debug("start on deployment " + deployment.url);
  +      log.debug("start step for deployment " + deployment.url);
         try 
         {
            for (Iterator lt = 
sortDeployments(deployment.subDeployments).listIterator(); lt.hasNext();) 
  @@ -635,7 +641,7 @@
   
            deployment.status="Deployed";
   
  -         log.info("Final (start) deployment step successfully completed on package: 
" + deployment.shortName);
  +         log.debug("Final (start) deployment step successfully completed on 
package: " + deployment.shortName);
         }  
         catch (Throwable t) 
         { 
  @@ -1084,7 +1090,7 @@
                  } // end of if ()
               } // end of for ()
               String shortName = DeploymentInfo.getShortName(path.toString());
  -             path.append("/").append(getNextID()).append(".").append(shortName);
  +            path.append("/").append(getNextID()).append(".").append(shortName);
               sdi.localUrl =  new File(tempDir,  path.toString()).toURL();
               copy(sdi.url, sdi.localUrl);
            }
  
  
  
  1.2       +5 -2      
jboss-system/src/main/org/jboss/deployment/MainDeployerMBean.java
  
  Index: MainDeployerMBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss-system/src/main/org/jboss/deployment/MainDeployerMBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MainDeployerMBean.java    24 Feb 2002 10:24:33 -0000      1.1
  +++ MainDeployerMBean.java    26 Feb 2002 05:15:02 -0000      1.2
  @@ -28,7 +28,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Toby Allsopp</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    *      <p><b>20011223 marc fleury:</b>
    *      <ul> 
    *      <li>add/RemoveURL, added the capacity to dynamically add a URL to watch
  @@ -74,6 +74,9 @@
      void setScan( boolean scan);
      boolean getScan();
      void setPeriod(int period);
  -   int getPeriod();   
  +   int getPeriod(); 
  +
  +   /** undeploys all packages **/
  +   void shutdown();  
   }
   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to