[jboss-cvs] JBossAS SVN: r88964 - trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri May 15 19:27:00 EDT 2009
Author: scott.stark at jboss.org
Date: 2009-05-15 19:27:00 -0400 (Fri, 15 May 2009)
New Revision: 88964
Modified:
trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
Log:
JBAS-6929, shutdown the scanExecutor in destroy if this bean created it
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java 2009-05-15 23:10:18 UTC (rev 88963)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java 2009-05-15 23:27:00 UTC (rev 88964)
@@ -75,6 +75,8 @@
*/
private ScheduledExecutorService scanExecutor;
private ScheduledFuture activeScan;
+ /** Did we create the ScheduledExecutorService */
+ private boolean createdScanExecutor;
/**
* Thread name used when the ScheduledExecutorService is created internally
@@ -125,6 +127,7 @@
public void setScanExecutor(ScheduledExecutorService scanExecutor)
{
this.scanExecutor = scanExecutor;
+ createdScanExecutor = false;
}
public String getScanThreadName()
@@ -190,6 +193,11 @@
}
}
+ public boolean isCreatedScanExecutor()
+ {
+ return createdScanExecutor;
+ }
+
public void create() throws Exception
{
// Default to a single thread executor
@@ -204,6 +212,7 @@
}
}
);
+ createdScanExecutor = true;
}
}
@@ -220,6 +229,21 @@
activeScan = null;
}
}
+ public void destroy()
+ {
+ // Shutdown the scanExecutor
+ if (scanExecutor != null && createdScanExecutor)
+ {
+ try
+ {
+ scanExecutor.shutdownNow();
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to cleanly shutdown scanExecutor", e);
+ }
+ }
+ }
/**
* Executes scan
More information about the jboss-cvs-commits
mailing list