Search in sources :

Example 6 with QueryResultsRegionImpl

use of org.hibernate.cache.infinispan.query.QueryResultsRegionImpl in project hibernate-orm by hibernate.

the class InfinispanRegionFactory method buildQueryResultsRegion.

@Override
public QueryResultsRegion buildQueryResultsRegion(String regionName, Map<String, Object> configValues) {
    if (log.isDebugEnabled()) {
        log.debug("Building query results cache region [" + regionName + "]");
    }
    final AdvancedCache cache = getCache(regionName, DataType.QUERY, null);
    final QueryResultsRegionImpl region = new QueryResultsRegionImpl(cache, regionName, transactionManager, this);
    startRegion(region);
    return region;
}
Also used : QueryResultsRegionImpl(org.hibernate.cache.infinispan.query.QueryResultsRegionImpl) AdvancedCache(org.infinispan.AdvancedCache)

Example 7 with QueryResultsRegionImpl

use of org.hibernate.cache.infinispan.query.QueryResultsRegionImpl in project hibernate-orm by hibernate.

the class InfinispanRegionFactoryTestCase method testDisableStatistics.

@Test
public void testDisableStatistics() {
    Properties p = createProperties();
    p.setProperty("hibernate.cache.infinispan.statistics", "false");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.expiration.lifespan", "60000");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.expiration.max_idle", "30000");
    p.setProperty("hibernate.cache.infinispan.entity.cfg", "myentity-cache");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.strategy", "FIFO");
    p.setProperty("hibernate.cache.infinispan.entity.expiration.wake_up_interval", "3000");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000");
    InfinispanRegionFactory factory = createRegionFactory(p);
    try {
        EntityRegionImpl region = (EntityRegionImpl) factory.buildEntityRegion("com.acme.Address", p, MUTABLE_NON_VERSIONED);
        AdvancedCache cache = region.getCache();
        assertFalse(cache.getCacheConfiguration().jmxStatistics().enabled());
        region = (EntityRegionImpl) factory.buildEntityRegion("com.acme.Person", p, MUTABLE_NON_VERSIONED);
        cache = region.getCache();
        assertFalse(cache.getCacheConfiguration().jmxStatistics().enabled());
        final String query = "org.hibernate.cache.internal.StandardQueryCache";
        QueryResultsRegionImpl queryRegion = (QueryResultsRegionImpl) factory.buildQueryResultsRegion(query, p);
        cache = queryRegion.getCache();
        assertFalse(cache.getCacheConfiguration().jmxStatistics().enabled());
        final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache";
        ConfigurationBuilder builder = new ConfigurationBuilder();
        builder.clustering().stateTransfer().fetchInMemoryState(true);
        factory.getCacheManager().defineConfiguration("timestamps", builder.build());
        TimestampsRegionImpl timestampsRegion = (TimestampsRegionImpl) factory.buildTimestampsRegion(timestamps, p);
        cache = timestampsRegion.getCache();
        assertFalse(cache.getCacheConfiguration().jmxStatistics().enabled());
        CollectionRegionImpl collectionRegion = (CollectionRegionImpl) factory.buildCollectionRegion("com.acme.Person.addresses", p, MUTABLE_NON_VERSIONED);
        cache = collectionRegion.getCache();
        assertFalse(cache.getCacheConfiguration().jmxStatistics().enabled());
    } finally {
        factory.stop();
    }
}
Also used : QueryResultsRegionImpl(org.hibernate.cache.infinispan.query.QueryResultsRegionImpl) TimestampsRegionImpl(org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) ClusteringConfigurationBuilder(org.infinispan.configuration.cache.ClusteringConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) InfinispanRegionFactory(org.hibernate.cache.infinispan.InfinispanRegionFactory) EntityRegionImpl(org.hibernate.cache.infinispan.entity.EntityRegionImpl) CollectionRegionImpl(org.hibernate.cache.infinispan.collection.CollectionRegionImpl) AdvancedCache(org.infinispan.AdvancedCache) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

QueryResultsRegionImpl (org.hibernate.cache.infinispan.query.QueryResultsRegionImpl)7 AdvancedCache (org.infinispan.AdvancedCache)7 Properties (java.util.Properties)6 Test (org.junit.Test)6 InfinispanRegionFactory (org.hibernate.cache.infinispan.InfinispanRegionFactory)5 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 CyclicBarrier (java.util.concurrent.CyclicBarrier)2 TimeUnit (java.util.concurrent.TimeUnit)2 AssertionFailedError (junit.framework.AssertionFailedError)2 Session (org.hibernate.Session)2 SessionFactory (org.hibernate.SessionFactory)2 Transaction (org.hibernate.Transaction)2 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)2 CollectionRegionImpl (org.hibernate.cache.infinispan.collection.CollectionRegionImpl)2 EntityRegionImpl (org.hibernate.cache.infinispan.entity.EntityRegionImpl)2 TimestampsRegionImpl (org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl)2 StandardQueryCache (org.hibernate.cache.internal.StandardQueryCache)2