Hack-fix for Repository start/stop issues

- Nick will investigate further
 - JBPM is shutting down Hibernate (along with shared resources) in a finalize()


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19135 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-03-09 00:47:59 +00:00
parent 7e837dcc74
commit ccd0614e8a
2 changed files with 17 additions and 6 deletions

View File

@@ -168,10 +168,10 @@ public class RepositoryStartStopTest extends TestCase
* a context twice without error, using it * a context twice without error, using it
* when running. * when running.
* *
* DISABLED - the full context breaks * - the full context breaks
* when you close and re-open it! * when you close and re-open it!
*/ */
public void DISABLEDtestOpenCloseOpenCloseFull() throws Exception public void testOpenCloseOpenCloseFull() throws Exception
{ {
assertNoCachedApplicationContext(); assertNoCachedApplicationContext();
@@ -210,10 +210,10 @@ public class RepositoryStartStopTest extends TestCase
* 4 different times, sometimes full ones, * 4 different times, sometimes full ones,
* sometimes minimal ones with no autostart. * sometimes minimal ones with no autostart.
* *
* DISABLED - the full context breaks * - the full context breaks
* when you close and re-open it! * when you close and re-open it!
*/ */
public void DISABLEDtestOpenCloseRepeatedly() throws Exception { public void testOpenCloseRepeatedly() throws Exception {
assertNoCachedApplicationContext(); assertNoCachedApplicationContext();
// Open the minimal one and test // Open the minimal one and test

View File

@@ -190,6 +190,14 @@ public class InternalEhCacheManagerFactoryBean implements FactoryBean<CacheManag
*/ */
public void stop() public void stop()
{ {
// TODO: Does this port over different Locales?
// Better to override DbPersistenceServiceFactory#close to put a marker on the thread.
if (Thread.currentThread().getName().contains("Finalizer"))
{
// Probably JBPM's finalizer code ... we rely on Spring context calls rather
return;
}
synchronized (getClass()) synchronized (getClass())
{ {
if(logger.isDebugEnabled()) { if(logger.isDebugEnabled()) {
@@ -199,8 +207,11 @@ public class InternalEhCacheManagerFactoryBean implements FactoryBean<CacheManag
} }
} }
InternalEhCacheManagerFactoryBean.getInstance().shutdown(); if (initialized) // Avoid re-initialization if it has already been shut down
initialized = false; {
InternalEhCacheManagerFactoryBean.getInstance().shutdown();
initialized = false;
}
} }
} }