[jboss-cvs] JBossAS SVN: r94616 - branches/JBPAPP_4_3_0_GA_CP04_JBPAPP-2903/system/src/main/org/jboss/deployment/scanner.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 9 13:45:56 EDT 2009
Author: jiwils
Date: 2009-10-09 13:45:56 -0400 (Fri, 09 Oct 2009)
New Revision: 94616
Modified:
branches/JBPAPP_4_3_0_GA_CP04_JBPAPP-2903/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java
Log:
Fix for JBPAPP-2903. We now interrupt the scanner thread when we stop.
Modified: branches/JBPAPP_4_3_0_GA_CP04_JBPAPP-2903/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java
===================================================================
--- branches/JBPAPP_4_3_0_GA_CP04_JBPAPP-2903/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java 2009-10-09 17:21:31 UTC (rev 94615)
+++ branches/JBPAPP_4_3_0_GA_CP04_JBPAPP-2903/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java 2009-10-09 17:45:56 UTC (rev 94616)
@@ -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);
+
+ // Interrupte 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