[HHH-5511] (Infinispan Region.destroy() impl should call cache.stop()) Fixed.

[HHH-5512] (JndiInfinispanRegionFactory shouldn't try to stop CacheManager) Fixed.

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@20288 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Galder Zamarreno 2010-08-31 15:09:48 +00:00
parent 8176661952
commit 31037bd103
6 changed files with 21 additions and 12 deletions

View File

@ -88,4 +88,8 @@ public class JndiInfinispanRegionFactory extends InfinispanRegionFactory {
}
}
@Override
public void stop() {
// Do not attempt to stop a cache manager because it wasn't created by this region factory.
}
}

View File

@ -150,7 +150,8 @@ public abstract class BaseRegion implements Region {
public void destroy() throws CacheException {
try {
cacheAdapter.clear();
cacheAdapter.stop();
// cacheAdapter.clear();
} finally {
cacheAdapter.removeListener(this);
}

View File

@ -156,6 +156,11 @@ public interface CacheAdapter {
*/
void clear() throws CacheException;
/**
* Stops the cache.
*/
void stop();
/**
* Add listener to this cache.
*

View File

@ -32,6 +32,8 @@ import org.infinispan.config.Configuration;
import org.infinispan.context.Flag;
import org.infinispan.remoting.rpc.RpcManager;
import org.infinispan.util.concurrent.TimeoutException;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
/**
* CacheAdapterImpl.
@ -40,6 +42,7 @@ import org.infinispan.util.concurrent.TimeoutException;
* @since 3.5
*/
public class CacheAdapterImpl implements CacheAdapter {
private static final Log log = LogFactory.getLog(CacheAdapterImpl.class);
private final Cache cache;
@ -142,6 +145,12 @@ public class CacheAdapterImpl implements CacheAdapter {
}
}
public void stop() {
if (log.isTraceEnabled())
log.trace("Stop " + cache);
cache.stop();
}
private static boolean isClusteredInvalidation(Configuration.CacheMode cacheMode) {
return cacheMode == Configuration.CacheMode.INVALIDATION_ASYNC
|| cacheMode == Configuration.CacheMode.INVALIDATION_SYNC;

View File

@ -151,11 +151,6 @@ public abstract class AbstractCollectionRegionAccessStrategyTestCase extends Abs
super.tearDown();
if (localCollectionRegion != null)
localCollectionRegion.destroy();
if (remoteCollectionRegion != null)
remoteCollectionRegion.destroy();
try {
localCache.withFlags(FlagAdapter.CACHE_MODE_LOCAL).clear();
} catch (Exception e) {

View File

@ -138,11 +138,6 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
super.tearDown();
if (localEntityRegion != null)
localEntityRegion.destroy();
if (remoteEntityRegion != null)
remoteEntityRegion.destroy();
try {
localCache.withFlags(FlagAdapter.CACHE_MODE_LOCAL).clear();
} catch (Exception e) {