Author: dallen6
Date: 2009-03-04 10:55:27 -0500 (Wed, 04 Mar 2009)
New Revision: 1761
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
Log:
Changed finalize() method in ManagerImpl to cleanup() called by bootstrap code.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-04
15:24:10 UTC (rev 1760)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-04
15:55:27 UTC (rev 1761)
@@ -944,9 +944,20 @@
return taskExecutor;
}
- @Override
- protected void finalize() throws Throwable
+ /**
+ * Cleans up resources held by the manager prior to shutting down
+ * a VM.
+ */
+ public void cleanup()
{
+ shutdownExecutors();
+ }
+
+ /**
+ * Shuts down any executor services in the manager.
+ */
+ protected void shutdownExecutors()
+ {
taskExecutor.shutdown();
try {
// Wait a while for existing tasks to terminate
@@ -963,7 +974,7 @@
taskExecutor.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
- }
+ }
}
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-03-04
15:24:10 UTC (rev 1760)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-03-04
15:55:27 UTC (rev 1761)
@@ -217,6 +217,7 @@
public void shutdown()
{
endApplication(getApplicationContext());
+ manager.cleanup();
}
}