Search in sources :

Example 1 with DummyTransactionManagerLookup

use of org.infinispan.transaction.lookup.DummyTransactionManagerLookup in project galley by Commonjava.

the class NFSOwnerCacheProducer method getCacheMgr.

public EmbeddedCacheManager getCacheMgr() {
    final EmbeddedCacheManager cacheManager = new DefaultCacheManager(new GlobalConfigurationBuilder().globalJmxStatistics().jmxDomain("org.commonjava.maven.galley").build());
    // Want to enable dead lock check as lock will be used in FastLocalCacheProvider
    // and also set transaction mode to PESSIMISTIC with DummyTransactionManger.
    final Configuration configurationForNfs = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LRU).size(1000).type(EvictionType.COUNT).deadlockDetection().spinDuration(10, TimeUnit.SECONDS).enable().transaction().transactionManagerLookup(new DummyTransactionManagerLookup()).lockingMode(LockingMode.PESSIMISTIC).build();
    cacheManager.defineConfiguration(CACHE_NAME, configurationForNfs);
    // Default cache impl for the local file cache in FLCP, uses 7 day as an expiration duration, and trigger purge every 30 mins.
    final Long expirationDuration = 7 * 24 * 3600 * 1000L;
    Configuration configForLocalFile = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LRU).size(20000).type(EvictionType.COUNT).expiration().lifespan(expirationDuration).wakeUpInterval(30 * 60 * 1000L).maxIdle(expirationDuration).build();
    cacheManager.defineConfiguration(DEFAULT_LOCAL_CACHE_FILE_NAME, configForLocalFile);
    // A test cache impl to do unit-testing for this local file cache expiration for purging mechanism
    Configuration configForLocalFileTest = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LRU).size(1000).type(EvictionType.COUNT).expiration().lifespan(1000L).wakeUpInterval(100L).maxIdle(1000L).build();
    cacheManager.defineConfiguration(LOCAL_CACHE_FILE_NAME_FOR_TEST, configForLocalFileTest);
    return cacheManager;
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) DummyTransactionManagerLookup(org.infinispan.transaction.lookup.DummyTransactionManagerLookup) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) Configuration(org.infinispan.configuration.cache.Configuration) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Aggregations

Configuration (org.infinispan.configuration.cache.Configuration)1 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)1 DefaultCacheManager (org.infinispan.manager.DefaultCacheManager)1 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)1 DummyTransactionManagerLookup (org.infinispan.transaction.lookup.DummyTransactionManagerLookup)1