[jboss-cvs] JBossAS SVN: r95885 - 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
Sun Nov 1 01:07:20 EDT 2009
Author: jiwils
Date: 2009-11-01 01:07:19 -0400 (Sun, 01 Nov 2009)
New Revision: 95885
Modified:
branches/JBPAPP_4_3_0_GA_CP04_JBPAPP-2903/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java
Log:
Fix for JBPAPP-2903. Scanner thread now uses wait/notify instead of sleep/interrupt b/c interrupt can cause errant behavior is the application server is not shutting down.
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-11-01 01:46:23 UTC (rev 95884)
+++ branches/JBPAPP_4_3_0_GA_CP04_JBPAPP-2903/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java 2009-11-01 05:07:19 UTC (rev 95885)
@@ -69,7 +69,10 @@
/** HACK: Shutdown hook to get around problems with system service shutdown ordering. */
private Thread shutdownHook;
+ /** Sleep monitor; so we can wait/notify upon stop... */
+ private Object sleepMonitor = new Object();
+
/////////////////////////////////////////////////////////////////////////
// DeploymentScanner //
/////////////////////////////////////////////////////////////////////////
@@ -277,7 +280,12 @@
try
{
scannerLog.trace("Sleeping...");
- Thread.sleep(scanPeriod);
+
+ // changed to wait instead of sleep so we can notify upon stop
+ synchronized (sleepMonitor)
+ {
+ sleepMonitor.wait(scanPeriod);
+ }
}
catch (InterruptedException ignore) {}
}
@@ -347,8 +355,12 @@
{
scannerThread.setEnabled(false);
- // Interrupte the scanner thread in case it is sleeping...
- scannerThread.interrupt();
+ // Notify the scanner thread in case it is sleeping... We don't
+ // interrupt because the thread could be doing something else.
+ synchronized (sleepMonitor)
+ {
+ sleepMonitor.notify();
+ }
scannerThread.waitForInactive();
}
More information about the jboss-cvs-commits
mailing list