Search in sources :

Example 6 with AccessType

use of org.hibernate.cache.spi.access.AccessType in project hibernate-orm by hibernate.

the class AbstractNonFunctionalTest method getCacheModeParameters.

@CustomParameterized.Order(1)
@Parameterized.Parameters(name = "{2},{3}")
public List<Object[]> getCacheModeParameters() {
    ArrayList<Object[]> modes = new ArrayList<>();
    for (AccessType accessType : new AccessType[] { AccessType.TRANSACTIONAL, AccessType.READ_ONLY, AccessType.READ_WRITE }) {
        modes.add(new Object[] { CacheMode.INVALIDATION_SYNC, accessType });
    }
    for (AccessType accessType : new AccessType[] { AccessType.READ_ONLY, AccessType.READ_WRITE, AccessType.NONSTRICT_READ_WRITE }) {
        modes.add(new Object[] { CacheMode.REPL_SYNC, accessType });
        modes.add(new Object[] { CacheMode.DIST_SYNC, accessType });
        if (canUseLocalMode()) {
            modes.add(new Object[] { CacheMode.LOCAL, accessType });
        }
    }
    if (canUseLocalMode()) {
        modes.add(new Object[] { CacheMode.LOCAL, AccessType.TRANSACTIONAL });
    }
    return modes;
}
Also used : ArrayList(java.util.ArrayList) AccessType(org.hibernate.cache.spi.access.AccessType)

Example 7 with AccessType

use of org.hibernate.cache.spi.access.AccessType in project hibernate-orm by hibernate.

the class CacheImpl method determineCollectionRegionAccessStrategy.

@Override
public CollectionRegionAccessStrategy determineCollectionRegionAccessStrategy(Collection model) {
    final String cacheRegionName = cacheRegionPrefix + model.getCacheRegionName();
    CollectionRegionAccessStrategy accessStrategy = collectionRegionAccessStrategyMap.get(cacheRegionName);
    if (accessStrategy == null && settings.isSecondLevelCacheEnabled()) {
        final AccessType accessType = AccessType.fromExternalName(model.getCacheConcurrencyStrategy());
        if (accessType != null) {
            LOG.tracev("Building shared cache region for collection data [{0}]", model.getRole());
            CollectionRegion collectionRegion = regionFactory.buildCollectionRegion(cacheRegionName, sessionFactory.getProperties(), CacheDataDescriptionImpl.decode(model));
            accessStrategy = collectionRegion.buildAccessStrategy(accessType);
            collectionRegionAccessStrategyMap.put(cacheRegionName, accessStrategy);
        }
    }
    return accessStrategy;
}
Also used : CollectionRegion(org.hibernate.cache.spi.CollectionRegion) CollectionRegionAccessStrategy(org.hibernate.cache.spi.access.CollectionRegionAccessStrategy) AccessType(org.hibernate.cache.spi.access.AccessType)

Aggregations

AccessType (org.hibernate.cache.spi.access.AccessType)7 ArrayList (java.util.ArrayList)4 List (java.util.List)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Session (org.hibernate.Session)3 FutureUpdate (org.hibernate.cache.infinispan.util.FutureUpdate)3 ExpectingInterceptor (org.hibernate.test.cache.infinispan.util.ExpectingInterceptor)3 TestInfinispanRegionFactory (org.hibernate.test.cache.infinispan.util.TestInfinispanRegionFactory)3 AdvancedCache (org.infinispan.AdvancedCache)3 PutKeyValueCommand (org.infinispan.commands.write.PutKeyValueCommand)3 Map (java.util.Map)2 TimeUnit (java.util.concurrent.TimeUnit)2 Predicate (java.util.function.Predicate)2 PutFromLoadValidator (org.hibernate.cache.infinispan.access.PutFromLoadValidator)2 TombstoneUpdate (org.hibernate.cache.infinispan.util.TombstoneUpdate)2 JdbcResourceLocalTransactionCoordinatorBuilderImpl (org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorBuilderImpl)2 BeforeClassOnce (org.hibernate.testing.BeforeClassOnce)2 Cache (org.infinispan.Cache)2 After (org.junit.After)2 Assert.assertEquals (org.junit.Assert.assertEquals)2