Author: jeff.yuchang
Date: 2009-11-27 13:15:31 -0500 (Fri, 27 Nov 2009)
New Revision: 347
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
Log:
* cleanup resources when AS gets shutdown.
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-27
16:05:34 UTC (rev 346)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-27
18:15:31 UTC (rev 347)
@@ -328,8 +328,77 @@
_scheduler.start();
}
+
public void close() throws Exception {
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ try {
+ if (_bpelServer != null)
+ try {
+ __log.debug("shutting down BPEL server.");
+ _bpelServer.shutdown();
+ _bpelServer = null;
+ } catch (Throwable ex) {
+ __log.debug("Error stopping services.", ex);
+ }
+
+ if( _cronScheduler != null ) {
+ try {
+ __log.debug("shutting down cron scheduler.");
+ _cronScheduler.shutdown();
+ _cronScheduler = null;
+ } catch (Exception ex) {
+ __log.debug("Cron scheduler couldn't be shutdown.", ex);
+ }
+ }
+
+ if (_scheduler != null)
+ try {
+ __log.debug("shutting down scheduler.");
+ _scheduler.shutdown();
+ _scheduler = null;
+ } catch (Exception ex) {
+ __log.debug("Scheduler couldn't be shutdown.", ex);
+ }
+
+ if (_store != null)
+ try {
+ _store.shutdown();
+ _store = null;
+ } catch (Throwable t) {
+ __log.debug("Store could not be shutdown.", t);
+ }
+
+ if (_daoCF != null)
+ try {
+ _daoCF.shutdown();
+ } catch (Throwable ex) {
+ __log.debug("DOA shutdown failed.", ex);
+ } finally {
+ _daoCF = null;
+ }
+
+ if (_db != null)
+ try {
+ _db.shutdown();
+
+ } catch (Throwable ex) {
+ __log.debug("DB shutdown failed.", ex);
+ } finally {
+ _db = null;
+ }
+
+ if (_txMgr != null) {
+ __log.debug("shutting down transaction manager.");
+ _txMgr = null;
+ }
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(old);
+ }
+
+
}
private void initDataSource() throws Exception {
Show replies by date