[jboss-cvs] JBossAS SVN: r94624 - branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/scanner.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 9 16:15:24 EDT 2009


Author: jiwils
Date: 2009-10-09 16:15:23 -0400 (Fri, 09 Oct 2009)
New Revision: 94624

Modified:
   branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java
Log:
Fix for JBPAPP-2905.  Deployment scanner stopService interupts the scanning thread.

Modified: branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java	2009-10-09 19:50:34 UTC (rev 94623)
+++ branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java	2009-10-09 20:15:23 UTC (rev 94624)
@@ -57,7 +57,7 @@
 
    /** The stop timeout */
    protected long stopTimeOut = 60000;
-   
+
    /** A proxy to the deployer we are using. */
    protected Deployer deployer;
 
@@ -68,8 +68,8 @@
 
    /** HACK: Shutdown hook to get around problems with system service shutdown ordering. */
    private Thread shutdownHook;
-   
 
+
    /////////////////////////////////////////////////////////////////////////
    //                           DeploymentScanner                         //
    /////////////////////////////////////////////////////////////////////////
@@ -172,7 +172,7 @@
          {
             lock.notifyAll();
          }
-         
+
          scannerLog.debug("Notified that enabled: " + enabled);
       }
 
@@ -190,7 +190,7 @@
 
          // jason: shall we also interrupt this thread?
       }
-    
+
       public void run()
       {
          scannerLog.debug("Running");
@@ -233,7 +233,7 @@
                active.notifyAll();
             }
          }
-         
+
          scannerLog.debug("Shutdown");
       }
 
@@ -255,7 +255,7 @@
          if (interrupted)
             Thread.currentThread().interrupt();
       }
-      
+
       public void doScan()
       {
          // Scan for new/removed/changed/whatever
@@ -266,7 +266,7 @@
             scannerLog.error("Scanning failed; continuing", e);
          }
       }
-      
+
       protected void loop()
       {
          while (enabled.get() && shuttingDown.get() == false)
@@ -301,7 +301,7 @@
       log.debug("Scanner thread started");
 
       // HACK
-      // 
+      //
       // install a shutdown hook, as the current system service shutdown
       // mechanism will not call this until all other services have stopped.
       // we need to know soon, so we can stop scanning to try to avoid
@@ -311,13 +311,13 @@
       shutdownHook = new Thread("DeploymentScanner Shutdown Hook")
          {
             ScannerThread thread = _scannerThread;
-            
+
             public void run()
             {
                thread.shutdown();
             }
          };
-      
+
       try
       {
          Runtime.getRuntime().addShutdownHook(shutdownHook);
@@ -328,7 +328,7 @@
       }
    }
 
-   protected void startService() throws Exception 
+   protected void startService() throws Exception
    {
       synchronized( scannerThread )
       {
@@ -339,18 +339,22 @@
          scannerThread.setEnabled(scanEnabled);
       }
    }
-   
-   protected void stopService() throws Exception 
+
+   protected void stopService() throws Exception
    {
       // disable scanner thread
       if( scannerThread != null )
       {
          scannerThread.setEnabled(false);
+
+         // Interrupt the scanner thread in case it is sleeping...
+         scannerThread.interrupt();
+
          scannerThread.waitForInactive();
       }
    }
 
-   protected void destroyService() throws Exception 
+   protected void destroyService() throws Exception
    {
       // drop our ref to deployer, so scan will fail
       deployer = null;
@@ -365,7 +369,7 @@
       }
 
       // HACK
-      // 
+      //
       // remove the shutdown hook, we don't need it anymore
       try
       {




More information about the jboss-cvs-commits mailing list