HHH-10215 Upgrade to Infinispan 8.0
This commit is contained in:
parent
63b4f69deb
commit
9372803718
|
@ -16,7 +16,9 @@ import org.hibernate.cache.spi.RegionFactory;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.infinispan.AdvancedCache;
|
import org.infinispan.AdvancedCache;
|
||||||
|
import org.infinispan.CacheSet;
|
||||||
import org.infinispan.commons.util.CloseableIterable;
|
import org.infinispan.commons.util.CloseableIterable;
|
||||||
|
import org.infinispan.commons.util.CloseableIterator;
|
||||||
import org.infinispan.container.entries.CacheEntry;
|
import org.infinispan.container.entries.CacheEntry;
|
||||||
import org.infinispan.context.Flag;
|
import org.infinispan.context.Flag;
|
||||||
import org.infinispan.notifications.Listener;
|
import org.infinispan.notifications.Listener;
|
||||||
|
@ -109,14 +111,14 @@ public class ClusteredTimestampsRegionImpl extends TimestampsRegionImpl {
|
||||||
* Brings all data from the distributed cache into our local cache.
|
* Brings all data from the distributed cache into our local cache.
|
||||||
*/
|
*/
|
||||||
private void populateLocalCache() {
|
private void populateLocalCache() {
|
||||||
CloseableIterable<Object> iterable = Caches.keys(cache);
|
CloseableIterator iterator = cache.keySet().iterator();
|
||||||
try {
|
try {
|
||||||
for (Object key : iterable) {
|
while (iterator.hasNext()) {
|
||||||
get(null, key);
|
get(null, iterator.next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
iterable.close();
|
iterator.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
package org.hibernate.cache.infinispan.util;
|
package org.hibernate.cache.infinispan.util;
|
||||||
|
|
||||||
import org.hibernate.internal.util.compare.EqualsHelper;
|
import org.hibernate.internal.util.compare.EqualsHelper;
|
||||||
|
import org.infinispan.commands.CommandInvocationId;
|
||||||
import org.infinispan.commands.write.AbstractDataWriteCommand;
|
import org.infinispan.commands.write.AbstractDataWriteCommand;
|
||||||
import org.infinispan.commands.write.InvalidateCommand;
|
import org.infinispan.commands.write.InvalidateCommand;
|
||||||
import org.infinispan.context.Flag;
|
import org.infinispan.context.Flag;
|
||||||
|
@ -14,7 +15,6 @@ import org.infinispan.notifications.cachelistener.CacheNotifier;
|
||||||
import org.infinispan.remoting.transport.Address;
|
import org.infinispan.remoting.transport.Address;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -23,56 +23,14 @@ import java.util.Set;
|
||||||
* @author Radim Vansa <rvansa@redhat.com>
|
* @author Radim Vansa <rvansa@redhat.com>
|
||||||
*/
|
*/
|
||||||
public class BeginInvalidationCommand extends InvalidateCommand {
|
public class BeginInvalidationCommand extends InvalidateCommand {
|
||||||
// this is a hack to keep compatibility with both Infinispan 7 and 8
|
|
||||||
// TODO: remove this when rebasing on Infinispan 8
|
|
||||||
private static final Field commandInvocationIdField;
|
|
||||||
private static final Method generateIdMethod;
|
|
||||||
|
|
||||||
static {
|
|
||||||
Field commandInvocationId = null;
|
|
||||||
Method generateId = null;
|
|
||||||
try {
|
|
||||||
commandInvocationId = AbstractDataWriteCommand.class.getDeclaredField("commandInvocationId");
|
|
||||||
commandInvocationId.setAccessible(true);
|
|
||||||
Class commandInvocationIdClass = Class.forName("org.infinispan.commands.CommandInvocationId");
|
|
||||||
generateId = commandInvocationIdClass.getMethod("generateId", Address.class);
|
|
||||||
}
|
|
||||||
catch (NoSuchFieldException e) {
|
|
||||||
}
|
|
||||||
catch (ClassNotFoundException e) {
|
|
||||||
// already found field and not the class?
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
catch (NoSuchMethodException e) {
|
|
||||||
// already found field and not the method?
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
commandInvocationIdField = commandInvocationId;
|
|
||||||
generateIdMethod = generateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object sessionTransactionId;
|
private Object sessionTransactionId;
|
||||||
|
|
||||||
public BeginInvalidationCommand() {
|
public BeginInvalidationCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeginInvalidationCommand(CacheNotifier notifier, Set<Flag> flags, Object[] keys, Address address, Object sessionTransactionId) {
|
public BeginInvalidationCommand(CacheNotifier notifier, Set<Flag> flags, CommandInvocationId commandInvocationId, Object[] keys, Object sessionTransactionId) {
|
||||||
super();
|
super(notifier, flags, commandInvocationId, keys);
|
||||||
this.notifier = notifier;
|
|
||||||
this.flags = flags;
|
|
||||||
this.keys = keys;
|
|
||||||
this.sessionTransactionId = sessionTransactionId;
|
this.sessionTransactionId = sessionTransactionId;
|
||||||
if (commandInvocationIdField != null) {
|
|
||||||
try {
|
|
||||||
commandInvocationIdField.set(this, generateIdMethod.invoke(null, address));
|
|
||||||
}
|
|
||||||
catch (IllegalAccessException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
catch (InvocationTargetException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getSessionTransactionId() {
|
public Object getSessionTransactionId() {
|
||||||
|
@ -81,15 +39,6 @@ public class BeginInvalidationCommand extends InvalidateCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getParameters() {
|
public Object[] getParameters() {
|
||||||
Object commandInvocationId = null;
|
|
||||||
if (commandInvocationIdField != null) {
|
|
||||||
try {
|
|
||||||
commandInvocationId = commandInvocationIdField.get(this);
|
|
||||||
}
|
|
||||||
catch (IllegalAccessException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (keys == null || keys.length == 0) {
|
if (keys == null || keys.length == 0) {
|
||||||
return new Object[]{flags, sessionTransactionId, commandInvocationId, 0};
|
return new Object[]{flags, sessionTransactionId, commandInvocationId, 0};
|
||||||
}
|
}
|
||||||
|
@ -112,15 +61,7 @@ public class BeginInvalidationCommand extends InvalidateCommand {
|
||||||
}
|
}
|
||||||
flags = (Set<Flag>) args[0];
|
flags = (Set<Flag>) args[0];
|
||||||
sessionTransactionId = args[1];
|
sessionTransactionId = args[1];
|
||||||
Object commandInvocationId = args[2];
|
commandInvocationId = (CommandInvocationId) args[2];
|
||||||
if (commandInvocationIdField != null) {
|
|
||||||
try {
|
|
||||||
commandInvocationIdField.set(this, commandInvocationId);
|
|
||||||
}
|
|
||||||
catch (IllegalAccessException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int size = (Integer) args[3];
|
int size = (Integer) args[3];
|
||||||
keys = new Object[size];
|
keys = new Object[size];
|
||||||
if (size == 1) {
|
if (size == 1) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
package org.hibernate.cache.infinispan.util;
|
package org.hibernate.cache.infinispan.util;
|
||||||
|
|
||||||
import org.hibernate.cache.infinispan.access.PutFromLoadValidator;
|
import org.hibernate.cache.infinispan.access.PutFromLoadValidator;
|
||||||
|
import org.infinispan.commands.CommandInvocationId;
|
||||||
import org.infinispan.commands.ReplicableCommand;
|
import org.infinispan.commands.ReplicableCommand;
|
||||||
import org.infinispan.commands.module.ModuleCommandInitializer;
|
import org.infinispan.commands.module.ModuleCommandInitializer;
|
||||||
import org.infinispan.configuration.cache.Configuration;
|
import org.infinispan.configuration.cache.Configuration;
|
||||||
|
@ -66,7 +67,7 @@ public class CacheCommandInitializer implements ModuleCommandInitializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeginInvalidationCommand buildBeginInvalidationCommand(Set<Flag> flags, Object[] keys, Object sessionTransactionId) {
|
public BeginInvalidationCommand buildBeginInvalidationCommand(Set<Flag> flags, Object[] keys, Object sessionTransactionId) {
|
||||||
return new BeginInvalidationCommand(notifier, flags, keys, clusteringDependentLogic.getAddress(), sessionTransactionId);
|
return new BeginInvalidationCommand(notifier, flags, CommandInvocationId.generateId(clusteringDependentLogic.getAddress()), keys, sessionTransactionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EndInvalidationCommand buildEndInvalidationCommand(String cacheName, Object[] keys, Object sessionTransactionId) {
|
public EndInvalidationCommand buildEndInvalidationCommand(String cacheName, Object[] keys, Object sessionTransactionId) {
|
||||||
|
|
|
@ -278,7 +278,7 @@ public class Caches {
|
||||||
|
|
||||||
|
|
||||||
public static void removeAll(AdvancedCache cache) {
|
public static void removeAll(AdvancedCache cache) {
|
||||||
CloseableIterator it = keys(cache).iterator();
|
CloseableIterator it = cache.keySet().iterator();
|
||||||
try {
|
try {
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
// Cannot use it.next(); it.remove() due to ISPN-5653
|
// Cannot use it.next(); it.remove() due to ISPN-5653
|
||||||
|
@ -301,15 +301,7 @@ public class Caches {
|
||||||
Map<K, V> toMap();
|
Map<K, V> toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <K, V> CollectableCloseableIterable<K> keys(AdvancedCache<K, V> cache) {
|
|
||||||
return keys(cache, (KeyValueFilter<K, V>) AcceptAllKeyValueFilter.getInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <K, V> CollectableCloseableIterable<K> keys(AdvancedCache<K, V> cache, KeyValueFilter<K, V> filter) {
|
public static <K, V> CollectableCloseableIterable<K> keys(AdvancedCache<K, V> cache, KeyValueFilter<K, V> filter) {
|
||||||
if (cache.getCacheConfiguration().transaction().transactionMode().isTransactional()) {
|
|
||||||
// Dummy read to enlist the LocalTransaction as workaround for ISPN-5676
|
|
||||||
cache.containsKey(false);
|
|
||||||
}
|
|
||||||
// HHH-10023: we can't use keySet()
|
// HHH-10023: we can't use keySet()
|
||||||
final CloseableIterable<CacheEntry<K, Void>> entryIterable = cache
|
final CloseableIterable<CacheEntry<K, Void>> entryIterable = cache
|
||||||
.filterEntries( filter )
|
.filterEntries( filter )
|
||||||
|
@ -317,10 +309,6 @@ public class Caches {
|
||||||
return new CollectableCloseableIterableImpl<K, Void, K>(entryIterable, Selector.KEY);
|
return new CollectableCloseableIterableImpl<K, Void, K>(entryIterable, Selector.KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <K, V> CollectableCloseableIterable<V> values(AdvancedCache<K, V> cache) {
|
|
||||||
return values(cache, (KeyValueFilter<K, V>) AcceptAllKeyValueFilter.getInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <K, V> CollectableCloseableIterable<V> values(AdvancedCache<K, V> cache, KeyValueFilter<K, V> filter) {
|
public static <K, V> CollectableCloseableIterable<V> values(AdvancedCache<K, V> cache, KeyValueFilter<K, V> filter) {
|
||||||
if (cache.getCacheConfiguration().transaction().transactionMode().isTransactional()) {
|
if (cache.getCacheConfiguration().transaction().transactionMode().isTransactional()) {
|
||||||
// Dummy read to enlist the LocalTransaction as workaround for ISPN-5676
|
// Dummy read to enlist the LocalTransaction as workaround for ISPN-5676
|
||||||
|
@ -341,7 +329,6 @@ public class Caches {
|
||||||
return new CollectableCloseableIterableImpl<K, T, T>(entryIterable, Selector.VALUE);
|
return new CollectableCloseableIterableImpl<K, T, T>(entryIterable, Selector.VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static <K, V> MapCollectableCloseableIterable<K, V> entrySet(AdvancedCache<K, V> cache) {
|
public static <K, V> MapCollectableCloseableIterable<K, V> entrySet(AdvancedCache<K, V> cache) {
|
||||||
return entrySet(cache, (KeyValueFilter<K, V>) AcceptAllKeyValueFilter.getInstance());
|
return entrySet(cache, (KeyValueFilter<K, V>) AcceptAllKeyValueFilter.getInstance());
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
-->
|
-->
|
||||||
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="urn:infinispan:config:7.2"
|
xmlns="urn:infinispan:config:8.0"
|
||||||
xsi:schemaLocation="urn:infinispan:config:7.2 http://www.infinispan.org/schemas/infinispan-config-7.2.xsd">
|
xsi:schemaLocation="urn:infinispan:config:8.0 http://www.infinispan.org/schemas/infinispan-config-8.0.xsd">
|
||||||
|
|
||||||
<jgroups>
|
<jgroups>
|
||||||
<stack-file name="hibernate-jgroups" path="${hibernate.cache.infinispan.jgroups_cfg:default-configs/default-jgroups-tcp.xml}"/>
|
<stack-file name="hibernate-jgroups" path="${hibernate.cache.infinispan.jgroups_cfg:default-configs/default-jgroups-tcp.xml}"/>
|
||||||
|
@ -16,51 +16,51 @@
|
||||||
<cache-container name="SampleCacheManager" statistics="false" default-cache="the-default-cache" shutdown-hook="DEFAULT">
|
<cache-container name="SampleCacheManager" statistics="false" default-cache="the-default-cache" shutdown-hook="DEFAULT">
|
||||||
<transport stack="hibernate-jgroups" cluster="infinispan-hibernate-cluster"/>
|
<transport stack="hibernate-jgroups" cluster="infinispan-hibernate-cluster"/>
|
||||||
|
|
||||||
<local-cache name="the-default-cache" statistics="false" />
|
<local-cache-configuration name="the-default-cache" statistics="false" />
|
||||||
|
|
||||||
<!-- Default configuration is appropriate for entity/collection caching. -->
|
<!-- Default configuration is appropriate for entity/collection caching. -->
|
||||||
<invalidation-cache name="entity" mode="SYNC" remote-timeout="20000">
|
<invalidation-cache-configuration name="entity" mode="SYNC" remote-timeout="20000">
|
||||||
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
||||||
<transaction mode="NONE" />
|
<transaction mode="NONE" />
|
||||||
<eviction max-entries="10000" strategy="LRU"/>
|
<eviction max-entries="10000" strategy="LRU"/>
|
||||||
<expiration max-idle="100000" interval="5000"/>
|
<expiration max-idle="100000" interval="5000"/>
|
||||||
</invalidation-cache>
|
</invalidation-cache-configuration>
|
||||||
|
|
||||||
<!-- Default configuration for immutable entities -->
|
<!-- Default configuration for immutable entities -->
|
||||||
<invalidation-cache name="immutable-entity" mode="SYNC" remote-timeout="20000">
|
<invalidation-cache-configuration name="immutable-entity" mode="SYNC" remote-timeout="20000">
|
||||||
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
||||||
<transaction mode="NONE"/>
|
<transaction mode="NONE"/>
|
||||||
<eviction max-entries="10000" strategy="LRU"/>
|
<eviction max-entries="10000" strategy="LRU"/>
|
||||||
<expiration max-idle="100000" interval="5000"/>
|
<expiration max-idle="100000" interval="5000"/>
|
||||||
</invalidation-cache>
|
</invalidation-cache-configuration>
|
||||||
|
|
||||||
<!-- A config appropriate for query caching. Does not replicate queries. -->
|
<!-- A config appropriate for query caching. Does not replicate queries. -->
|
||||||
<local-cache name="local-query">
|
<local-cache-configuration name="local-query">
|
||||||
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
||||||
<transaction mode="NONE" />
|
<transaction mode="NONE" />
|
||||||
<eviction max-entries="10000" strategy="LRU"/>
|
<eviction max-entries="10000" strategy="LRU"/>
|
||||||
<expiration max-idle="100000" interval="5000"/>
|
<expiration max-idle="100000" interval="5000"/>
|
||||||
</local-cache>
|
</local-cache-configuration>
|
||||||
|
|
||||||
<!-- A query cache that replicates queries. Replication is asynchronous. -->
|
<!-- A query cache that replicates queries. Replication is asynchronous. -->
|
||||||
<replicated-cache name="replicated-query" mode="ASYNC">
|
<replicated-cache-configuration name="replicated-query" mode="ASYNC">
|
||||||
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
||||||
<transaction mode="NONE" />
|
<transaction mode="NONE" />
|
||||||
<eviction max-entries="10000" strategy="LRU"/>
|
<eviction max-entries="10000" strategy="LRU"/>
|
||||||
<expiration max-idle="100000" interval="5000"/>
|
<expiration max-idle="100000" interval="5000"/>
|
||||||
</replicated-cache>
|
</replicated-cache-configuration>
|
||||||
|
|
||||||
<!-- Optimized for timestamp caching. A clustered timestamp cache
|
<!-- Optimized for timestamp caching. A clustered timestamp cache
|
||||||
is required if query caching is used, even if the query cache
|
is required if query caching is used, even if the query cache
|
||||||
itself is configured with CacheMode=LOCAL. -->
|
itself is configured with CacheMode=LOCAL. -->
|
||||||
<replicated-cache name="timestamps" mode="ASYNC">
|
<replicated-cache-configuration name="timestamps" mode="ASYNC">
|
||||||
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
<locking concurrency-level="1000" acquire-timeout="15000"/>
|
||||||
<!-- Explicitly non transactional -->
|
<!-- Explicitly non transactional -->
|
||||||
<transaction mode="NONE"/>
|
<transaction mode="NONE"/>
|
||||||
<!-- Don't ever evict modification timestamps -->
|
<!-- Don't ever evict modification timestamps -->
|
||||||
<eviction strategy="NONE"/>
|
<eviction strategy="NONE"/>
|
||||||
<expiration interval="0"/>
|
<expiration interval="0"/>
|
||||||
</replicated-cache>
|
</replicated-cache-configuration>
|
||||||
</cache-container>
|
</cache-container>
|
||||||
|
|
||||||
</infinispan>
|
</infinispan>
|
||||||
|
|
|
@ -170,10 +170,10 @@ public abstract class AbstractGeneralDataRegionTest extends AbstractRegionImplTe
|
||||||
SessionImplementor remoteSession = (SessionImplementor) sessionFactories.get(1).openSession();
|
SessionImplementor remoteSession = (SessionImplementor) sessionFactories.get(1).openSession();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Set localKeys = Caches.keys(localCache).toSet();
|
Set localKeys = localCache.keySet();
|
||||||
assertEquals( "No valid children in " + localKeys, 0, localKeys.size() );
|
assertEquals( "No valid children in " + localKeys, 0, localKeys.size() );
|
||||||
|
|
||||||
Set remoteKeys = Caches.keys(remoteCache).toSet();
|
Set remoteKeys = remoteCache.keySet();
|
||||||
assertEquals( "No valid children in " + remoteKeys, 0, remoteKeys.size() );
|
assertEquals( "No valid children in " + remoteKeys, 0, remoteKeys.size() );
|
||||||
|
|
||||||
assertNull( "local is clean", localRegion.get(null, KEY ) );
|
assertNull( "local is clean", localRegion.get(null, KEY ) );
|
||||||
|
@ -197,14 +197,14 @@ public abstract class AbstractGeneralDataRegionTest extends AbstractRegionImplTe
|
||||||
sleep( 250 );
|
sleep( 250 );
|
||||||
// This should re-establish the region root node in the optimistic case
|
// This should re-establish the region root node in the optimistic case
|
||||||
assertNull( localRegion.get(null, KEY ) );
|
assertNull( localRegion.get(null, KEY ) );
|
||||||
localKeys = Caches.keys(localCache).toSet();
|
localKeys = localCache.keySet();
|
||||||
assertEquals( "No valid children in " + localKeys, 0, localKeys.size() );
|
assertEquals( "No valid children in " + localKeys, 0, localKeys.size() );
|
||||||
|
|
||||||
// Re-establishing the region root on the local node doesn't
|
// Re-establishing the region root on the local node doesn't
|
||||||
// propagate it to other nodes. Do a get on the remote node to re-establish
|
// propagate it to other nodes. Do a get on the remote node to re-establish
|
||||||
// This only adds a node in the case of optimistic locking
|
// This only adds a node in the case of optimistic locking
|
||||||
assertEquals( null, remoteRegion.get(null, KEY ) );
|
assertEquals( null, remoteRegion.get(null, KEY ) );
|
||||||
remoteKeys = Caches.keys(remoteCache).toSet();
|
remoteKeys = remoteCache.keySet();
|
||||||
assertEquals( "No valid children in " + remoteKeys, 0, remoteKeys.size() );
|
assertEquals( "No valid children in " + remoteKeys, 0, remoteKeys.size() );
|
||||||
|
|
||||||
assertEquals( "local is clean", null, localRegion.get(null, KEY ) );
|
assertEquals( "local is clean", null, localRegion.get(null, KEY ) );
|
||||||
|
|
|
@ -71,7 +71,7 @@ public abstract class AbstractNonInvalidationTest extends SingleNodeTest {
|
||||||
Item item = new Item("my item", "Original item");
|
Item item = new Item("my item", "Original item");
|
||||||
withTxSession(s -> s.persist(item));
|
withTxSession(s -> s.persist(item));
|
||||||
entityCache.clear();
|
entityCache.clear();
|
||||||
assertEquals("Cache is not empty", Collections.EMPTY_SET, Caches.keys(entityCache).toSet());
|
assertEquals("Cache is not empty", Collections.EMPTY_SET, entityCache.keySet());
|
||||||
itemId = item.getId();
|
itemId = item.getId();
|
||||||
log.info("Insert and clear finished");
|
log.info("Insert and clear finished");
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.hibernate.test.cache.infinispan.tm.XaConnectionProvider;
|
||||||
import org.hibernate.testing.env.ConnectionProviderBuilder;
|
import org.hibernate.testing.env.ConnectionProviderBuilder;
|
||||||
import org.infinispan.AdvancedCache;
|
import org.infinispan.AdvancedCache;
|
||||||
import org.infinispan.commons.util.CloseableIterable;
|
import org.infinispan.commons.util.CloseableIterable;
|
||||||
|
import org.infinispan.commons.util.CloseableIterator;
|
||||||
import org.infinispan.context.Flag;
|
import org.infinispan.context.Flag;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -101,8 +102,9 @@ public class MultiTenancyTest extends SingleNodeTest {
|
||||||
// }
|
// }
|
||||||
EntityRegionImpl region = (EntityRegionImpl) sessionFactory().getSecondLevelCacheRegion(Item.class.getName());
|
EntityRegionImpl region = (EntityRegionImpl) sessionFactory().getSecondLevelCacheRegion(Item.class.getName());
|
||||||
AdvancedCache localCache = region.getCache().withFlags(Flag.CACHE_MODE_LOCAL);
|
AdvancedCache localCache = region.getCache().withFlags(Flag.CACHE_MODE_LOCAL);
|
||||||
CloseableIterable keys = Caches.keys(localCache);
|
|
||||||
assertEquals(1, localCache.size());
|
assertEquals(1, localCache.size());
|
||||||
assertEquals("OldCacheKeyImplementation", keys.iterator().next().getClass().getSimpleName());
|
try (CloseableIterator iterator = localCache.keySet().iterator()) {
|
||||||
|
assertEquals("OldCacheKeyImplementation", iterator.next().getClass().getSimpleName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.hibernate.cache.infinispan.util.Caches;
|
||||||
import org.hibernate.test.cache.infinispan.functional.entities.Item;
|
import org.hibernate.test.cache.infinispan.functional.entities.Item;
|
||||||
import org.infinispan.AdvancedCache;
|
import org.infinispan.AdvancedCache;
|
||||||
import org.infinispan.commons.util.CloseableIterable;
|
import org.infinispan.commons.util.CloseableIterable;
|
||||||
|
import org.infinispan.commons.util.CloseableIterator;
|
||||||
import org.infinispan.context.Flag;
|
import org.infinispan.context.Flag;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -38,8 +39,9 @@ public class NoTenancyTest extends SingleNodeTest {
|
||||||
}
|
}
|
||||||
EntityRegionImpl region = (EntityRegionImpl) sessionFactory().getSecondLevelCacheRegion(Item.class.getName());
|
EntityRegionImpl region = (EntityRegionImpl) sessionFactory().getSecondLevelCacheRegion(Item.class.getName());
|
||||||
AdvancedCache localCache = region.getCache().withFlags(Flag.CACHE_MODE_LOCAL);
|
AdvancedCache localCache = region.getCache().withFlags(Flag.CACHE_MODE_LOCAL);
|
||||||
CloseableIterable keys = Caches.keys(localCache);
|
|
||||||
assertEquals(1, localCache.size());
|
assertEquals(1, localCache.size());
|
||||||
assertEquals(sessionFactory().getClassMetadata(Item.class).getIdentifierType().getReturnedClass(), keys.iterator().next().getClass());
|
try (CloseableIterator iterator = localCache.keySet().iterator()) {
|
||||||
|
assertEquals(sessionFactory().getClassMetadata(Item.class).getIdentifierType().getReturnedClass(), iterator.next().getClass());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class NaturalIdInvalidationTest extends DualNodeTest {
|
||||||
deleteCitizenWithCriteria(remoteFactory);
|
deleteCitizenWithCriteria(remoteFactory);
|
||||||
sleep(250);
|
sleep(250);
|
||||||
|
|
||||||
Set localKeys = Caches.keys(localNaturalIdCache.getAdvancedCache()).toSet();
|
Set localKeys = localNaturalIdCache.keySet();
|
||||||
assertEquals(1, localKeys.size());
|
assertEquals(1, localKeys.size());
|
||||||
// Only key left is the one for the citizen *not* in France
|
// Only key left is the one for the citizen *not* in France
|
||||||
localKeys.toString().contains("000");
|
localKeys.toString().contains("000");
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.infinispan.context.Flag;
|
||||||
import org.infinispan.notifications.Listener;
|
import org.infinispan.notifications.Listener;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryActivated;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryActivated;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryEvicted;
|
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryInvalidated;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryInvalidated;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryLoaded;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryLoaded;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
|
||||||
|
@ -132,7 +131,6 @@ public class TimestampsRegionImplTest extends AbstractGeneralDataRegionTest {
|
||||||
|
|
||||||
@CacheEntryActivated
|
@CacheEntryActivated
|
||||||
@CacheEntryCreated
|
@CacheEntryCreated
|
||||||
@CacheEntryEvicted
|
|
||||||
@CacheEntryInvalidated
|
@CacheEntryInvalidated
|
||||||
@CacheEntryLoaded
|
@CacheEntryLoaded
|
||||||
@CacheEntryModified
|
@CacheEntryModified
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.infinispan.interceptors.base.CommandInterceptor;
|
||||||
import org.infinispan.notifications.Listener;
|
import org.infinispan.notifications.Listener;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryActivated;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryActivated;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryEvicted;
|
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryInvalidated;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryInvalidated;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryLoaded;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryLoaded;
|
||||||
import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
|
import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
|
||||||
|
@ -95,7 +94,6 @@ public class ClassLoaderAwareCache<K, V> extends AbstractDelegatingAdvancedCache
|
||||||
static {
|
static {
|
||||||
events.put(CacheEntryActivated.class, Event.Type.CACHE_ENTRY_ACTIVATED);
|
events.put(CacheEntryActivated.class, Event.Type.CACHE_ENTRY_ACTIVATED);
|
||||||
events.put(CacheEntryCreated.class, Event.Type.CACHE_ENTRY_CREATED);
|
events.put(CacheEntryCreated.class, Event.Type.CACHE_ENTRY_CREATED);
|
||||||
events.put(CacheEntryEvicted.class, Event.Type.CACHE_ENTRY_EVICTED);
|
|
||||||
events.put(CacheEntryInvalidated.class, Event.Type.CACHE_ENTRY_INVALIDATED);
|
events.put(CacheEntryInvalidated.class, Event.Type.CACHE_ENTRY_INVALIDATED);
|
||||||
events.put(CacheEntryLoaded.class, Event.Type.CACHE_ENTRY_LOADED);
|
events.put(CacheEntryLoaded.class, Event.Type.CACHE_ENTRY_LOADED);
|
||||||
events.put(CacheEntryModified.class, Event.Type.CACHE_ENTRY_MODIFIED);
|
events.put(CacheEntryModified.class, Event.Type.CACHE_ENTRY_MODIFIED);
|
||||||
|
@ -130,7 +128,6 @@ public class ClassLoaderAwareCache<K, V> extends AbstractDelegatingAdvancedCache
|
||||||
|
|
||||||
@CacheEntryActivated
|
@CacheEntryActivated
|
||||||
@CacheEntryCreated
|
@CacheEntryCreated
|
||||||
@CacheEntryEvicted
|
|
||||||
@CacheEntryInvalidated
|
@CacheEntryInvalidated
|
||||||
@CacheEntryLoaded
|
@CacheEntryLoaded
|
||||||
@CacheEntryModified
|
@CacheEntryModified
|
||||||
|
|
|
@ -13,7 +13,7 @@ ext {
|
||||||
// h2Version = '1.2.145'
|
// h2Version = '1.2.145'
|
||||||
h2Version = '1.3.176'
|
h2Version = '1.3.176'
|
||||||
bytemanVersion = '2.1.2'
|
bytemanVersion = '2.1.2'
|
||||||
infinispanVersion = '7.2.1.Final'
|
infinispanVersion = '8.0.1.Final'
|
||||||
jnpVersion = '5.0.6.CR1'
|
jnpVersion = '5.0.6.CR1'
|
||||||
elVersion = '2.2.4'
|
elVersion = '2.2.4'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue