Author: galder.zamarreno(a)jboss.com
Date: 2010-08-31 11:15:25 -0400 (Tue, 31 Aug 2010)
New Revision: 20289
Modified:
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseRegion.java
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapter.java
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapterImpl.java
core/branches/Branch_3_5/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/collection/AbstractCollectionRegionAccessStrategyTestCase.java
core/branches/Branch_3_5/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/entity/AbstractEntityRegionAccessStrategyTestCase.java
Log:
[HHH-5511] (Infinispan Region.destroy() impl should call cache.stop()) Fixed.
[HHH-5512] (JndiInfinispanRegionFactory shouldn't try to stop CacheManager) Fixed.
Modified:
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java
===================================================================
---
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java 2010-08-31
15:09:48 UTC (rev 20288)
+++
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java 2010-08-31
15:15:25 UTC (rev 20289)
@@ -86,6 +86,10 @@
}
}
}
- }
+ }
+ @Override
+ public void stop() {
+ // Do not attempt to stop a cache manager because it wasn't created by this
region factory.
+ }
}
Modified:
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseRegion.java
===================================================================
---
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseRegion.java 2010-08-31
15:09:48 UTC (rev 20288)
+++
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseRegion.java 2010-08-31
15:15:25 UTC (rev 20289)
@@ -150,7 +150,8 @@
public void destroy() throws CacheException {
try {
- cacheAdapter.clear();
+ cacheAdapter.stop();
+// cacheAdapter.clear();
} finally {
cacheAdapter.removeListener(this);
}
@@ -294,4 +295,4 @@
}
}
-}
\ No newline at end of file
+}
Modified:
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapter.java
===================================================================
---
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapter.java 2010-08-31
15:09:48 UTC (rev 20288)
+++
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapter.java 2010-08-31
15:15:25 UTC (rev 20289)
@@ -157,6 +157,11 @@
void clear() throws CacheException;
/**
+ * Stops the cache.
+ */
+ void stop();
+
+ /**
* Add listener to this cache.
*
* @param listener to be added to cache.
Modified:
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapterImpl.java
===================================================================
---
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapterImpl.java 2010-08-31
15:09:48 UTC (rev 20288)
+++
core/branches/Branch_3_5/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheAdapterImpl.java 2010-08-31
15:15:25 UTC (rev 20289)
@@ -32,6 +32,8 @@
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 @@
* @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 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;
Modified:
core/branches/Branch_3_5/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/collection/AbstractCollectionRegionAccessStrategyTestCase.java
===================================================================
---
core/branches/Branch_3_5/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2010-08-31
15:09:48 UTC (rev 20288)
+++
core/branches/Branch_3_5/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2010-08-31
15:15:25 UTC (rev 20289)
@@ -151,11 +151,6 @@
super.tearDown();
- if (localCollectionRegion != null)
- localCollectionRegion.destroy();
- if (remoteCollectionRegion != null)
- remoteCollectionRegion.destroy();
-
try {
localCache.withFlags(FlagAdapter.CACHE_MODE_LOCAL).clear();
} catch (Exception e) {
Modified:
core/branches/Branch_3_5/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/entity/AbstractEntityRegionAccessStrategyTestCase.java
===================================================================
---
core/branches/Branch_3_5/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/entity/AbstractEntityRegionAccessStrategyTestCase.java 2010-08-31
15:09:48 UTC (rev 20288)
+++
core/branches/Branch_3_5/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/entity/AbstractEntityRegionAccessStrategyTestCase.java 2010-08-31
15:15:25 UTC (rev 20289)
@@ -138,11 +138,6 @@
super.tearDown();
- if (localEntityRegion != null)
- localEntityRegion.destroy();
- if (remoteEntityRegion != null)
- remoteEntityRegion.destroy();
-
try {
localCache.withFlags(FlagAdapter.CACHE_MODE_LOCAL).clear();
} catch (Exception e) {