Skip to content

Commit

Permalink
Changed finalize() method in ManagerImpl to cleanup() called by boots…
Browse files Browse the repository at this point in the history
…trap code.

git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@1761 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
drallen committed Mar 4, 2009
1 parent c9e4e6e commit b5c5937
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 14 additions & 3 deletions webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
Expand Up @@ -944,8 +944,19 @@ public ExecutorService getTaskExecutor()
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 {
Expand All @@ -963,7 +974,7 @@ protected void finalize() throws Throwable
taskExecutor.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
}
}

}
Expand Up @@ -217,6 +217,7 @@ protected void endApplication(BeanStore applicationBeanStore)
public void shutdown()
{
endApplication(getApplicationContext());
manager.cleanup();
}

}

0 comments on commit b5c5937

Please sign in to comment.