mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-22 02:58:05 +00:00
HHH-9781 Update to Infinispan 7.2.1.Final
* The upgrade caused some tests that verified number of cached elements in memory to fail. The cause for this was the change in clear() operation which now is non-transactional, hence each element needs to be removed individually.
This commit is contained in:
parent
21abf08452
commit
37494f4a9f
@ -220,7 +220,7 @@ public void removeAll() throws CacheException {
|
||||
if ( !putValidator.invalidateRegion() ) {
|
||||
throw new CacheException( "Failed to invalidate pending putFromLoad calls for region " + region.getName() );
|
||||
}
|
||||
cache.clear();
|
||||
Caches.removeAll(cache);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.Transaction;
|
||||
@ -85,7 +84,8 @@ public BaseRegion(AdvancedCache cache, String name, RegionFactory factory) {
|
||||
this.tm = cache.getTransactionManager();
|
||||
this.factory = factory;
|
||||
this.regionClearCache = cache.withFlags(
|
||||
Flag.CACHE_MODE_LOCAL, Flag.ZERO_LOCK_ACQUISITION_TIMEOUT
|
||||
Flag.CACHE_MODE_LOCAL, Flag.ZERO_LOCK_ACQUISITION_TIMEOUT,
|
||||
Flag.SKIP_CACHE_LOAD
|
||||
);
|
||||
}
|
||||
|
||||
@ -170,27 +170,21 @@ public boolean checkValid() {
|
||||
// (without forcing autoCommit cache configuration).
|
||||
Transaction tx = getCurrentTransaction();
|
||||
if ( tx != null ) {
|
||||
regionClearCache.clear();
|
||||
log.tracef("Transaction, clearing one element at the time");
|
||||
Caches.removeAll(regionClearCache);
|
||||
} else {
|
||||
Caches.withinTx( cache, new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
regionClearCache.clear();
|
||||
return null;
|
||||
}
|
||||
} );
|
||||
log.tracef("Non-transactional, clear in one go");
|
||||
regionClearCache.clear();
|
||||
}
|
||||
|
||||
log.tracef("Transition state from CLEARING to VALID");
|
||||
invalidateState.compareAndSet(
|
||||
InvalidateState.CLEARING, InvalidateState.VALID
|
||||
);
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
if ( log.isTraceEnabled() ) {
|
||||
log.trace(
|
||||
"Could not invalidate region: "
|
||||
+ e.getLocalizedMessage()
|
||||
);
|
||||
log.trace("Could not invalidate region: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
import javax.transaction.TransactionManager;
|
||||
|
||||
import org.infinispan.AdvancedCache;
|
||||
import org.infinispan.commons.util.CloseableIterator;
|
||||
import org.infinispan.context.Flag;
|
||||
import org.infinispan.remoting.rpc.RpcManager;
|
||||
|
||||
@ -265,4 +266,16 @@ public static boolean isClustered(AdvancedCache cache) {
|
||||
.clustering().cacheMode().isClustered();
|
||||
}
|
||||
|
||||
public static void removeAll(AdvancedCache cache) {
|
||||
CloseableIterator it = cache.keySet().iterator();
|
||||
try {
|
||||
while (it.hasNext()) {
|
||||
it.next(); // Necessary to get next element
|
||||
it.remove();
|
||||
}
|
||||
} finally {
|
||||
it.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -146,10 +146,11 @@ public void testBulkOperations() throws Throwable {
|
||||
|
||||
List<Integer> updated = getContactsByTLF( "Updated" );
|
||||
assertNotNull( "Got updated contacts", updated );
|
||||
assertEquals( "Updated contacts", 5, updated.size() );
|
||||
assertEquals("Updated contacts", 5, updated.size());
|
||||
|
||||
assertEquals( 10, contactSlcs.getElementCountInMemory() );
|
||||
updateContactsWithOneManual( "Kabir", "UpdatedAgain" );
|
||||
assertEquals( contactSlcs.getElementCountInMemory(), 0 );
|
||||
assertEquals( 0, contactSlcs.getElementCountInMemory());
|
||||
for ( Integer id : jbContacts ) {
|
||||
Contact contact = getContact( id );
|
||||
assertNotNull( "JBoss contact " + id + " exists", contact );
|
||||
|
@ -30,7 +30,7 @@ ext {
|
||||
// h2Version = '1.2.145'
|
||||
h2Version = '1.3.176'
|
||||
bytemanVersion = '2.1.2'
|
||||
infinispanVersion = '7.1.0.Final'
|
||||
infinispanVersion = '7.2.1.Final'
|
||||
jnpVersion = '5.0.6.CR1'
|
||||
|
||||
libraries = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user