[jboss-cvs] JBossAS SVN: r95886 - 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
Sun Nov 1 01:12:52 EDT 2009
Author: jiwils
Date: 2009-11-01 01:12:52 -0400 (Sun, 01 Nov 2009)
New Revision: 95886
Modified:
branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java
Log:
Fix for JBPAPP-2905. The scanner thread now uses wait/notify instead of sleep/interupt as interupt can cause errant behavior if the thread isn't sleeping.
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-11-01 05:07:19 UTC (rev 95885)
+++ branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/scanner/AbstractDeploymentScanner.java 2009-11-01 05:12:52 UTC (rev 95886)
@@ -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);
- // Interrupt 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