@Produces @ApplicationScoped public EmbeddedCacheManager create() { GlobalConfiguration global = new GlobalConfigurationBuilder() .globalJmxStatistics().cacheManagerName("geekseek") .build(); Configuration local = new ConfigurationBuilder() .clustering() .cacheMode(CacheMode.LOCAL) .transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .transactionManagerLookup(new GenericTransactionManagerLookup()) .autoCommit(false) .build(); return new DefaultCacheManager(global, local); }
/** * Create the configuration of the internal query cache. */ private ConfigurationBuilder getQueryCacheConfig() { ConfigurationBuilder cfgBuilder = new ConfigurationBuilder(); cfgBuilder .clustering().cacheMode(CacheMode.LOCAL) .transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL) .expiration().maxIdle(ENTRY_LIFESPAN, TimeUnit.SECONDS) .memory().evictionType(EvictionType.COUNT).size(MAX_ENTRIES); return cfgBuilder; }
public static ConfigurationBuilder getDefaultClusteredCacheConfig(CacheMode mode, boolean transactional, boolean useCustomTxLookup) { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(transactional, useCustomTxLookup); builder. clustering() .cacheMode(mode) .transaction().cacheStopTimeout(0L); return builder; }
@Test public void testDistSyncAutoCommit() { Configuration configuration = new ConfigurationBuilder() .clustering().cacheMode(CacheMode.DIST_SYNC) .transaction().autoCommit(true) .build(); Assert.assertTrue(configuration.transaction().autoCommit()); Assert.assertEquals(configuration.clustering().cacheMode(), CacheMode.DIST_SYNC); }
/** * Create the configuration of the internal query cache. */ private ConfigurationBuilder getQueryCacheConfig() { ConfigurationBuilder cfgBuilder = new ConfigurationBuilder(); cfgBuilder .clustering().cacheMode(CacheMode.LOCAL) .transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL) .expiration().maxIdle(ENTRY_LIFESPAN, TimeUnit.SECONDS) .memory().evictionType(EvictionType.COUNT).size(MAX_ENTRIES); return cfgBuilder; }
private EmbeddedCacheManager createCacheManager() { ConfigurationBuilder c = TestCacheManagerFactory.getDefaultCacheConfiguration(false); c.clustering().cacheMode(CacheMode.REPL_SYNC) .transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); GlobalConfigurationBuilder gc = GlobalConfigurationBuilder.defaultClusteredBuilder(); return TestCacheManagerFactory.createClusteredCacheManager(gc, c); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = new ConfigurationBuilder(); builder .clustering().cacheMode(CacheMode.INVALIDATION_SYNC) .transaction().transactionMode(TransactionMode.TRANSACTIONAL) .locking().isolationLevel(IsolationLevel.READ_COMMITTED); createClusteredCaches(2, builder); }
private ConfigurationBuilder getBaseConfig() { ConfigurationBuilder cfg = TestCacheManagerFactory.getDefaultCacheConfiguration(true); cfg.clustering().cacheMode(CacheMode.DIST_SYNC) .transaction().transactionMode(TransactionMode.TRANSACTIONAL).recovery().disable() .locking() .lockAcquisitionTimeout(10000); return cfg; }
private Cache getCache() { GlobalConfigurationBuilder gc = GlobalConfigurationBuilder.defaultClusteredBuilder(); ConfigurationBuilder c = new ConfigurationBuilder(); c.clustering().cacheMode(CacheMode.REPL_SYNC) .remoteTimeout(30000) .transaction().invocationBatching().enable() .locking().lockAcquisitionTimeout(60000).useLockStriping(false); EmbeddedCacheManager container = TestCacheManagerFactory.createClusteredCacheManager(gc, c); cacheContainers.add(container); container.defineConfiguration("TestCache", c.build()); return container.getCache("TestCache"); } }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().cacheMode(CacheMode.DIST_SYNC) .remoteTimeout(5000) .transaction().transactionMode(TransactionMode.TRANSACTIONAL).cacheStopTimeout(100); EmbeddedCacheManager cm1 = TestCacheManagerFactory.createClusteredCacheManager(cb); EmbeddedCacheManager cm2 = TestCacheManagerFactory.createClusteredCacheManager(cb); registerCacheManager(cm1, cm2); c1 = cm1.getCache(); c2 = cm2.getCache(); waitForClusterToForm(); }
public static ConfigurationBuilder createLocalCacheConfiguration() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder .clustering() .cacheMode(CacheMode.LOCAL) .transaction() .transactionMode(TransactionMode.NON_TRANSACTIONAL) .locking() .lockAcquisitionTimeout(10000) .invocationBatching() .disable() .deadlockDetection() .disable() .jmxStatistics() .disable() ; return builder; }
protected void createCacheManagers() throws Throwable { ConfigurationBuilder c = new ConfigurationBuilder(); c.clustering().cacheMode(CacheMode.REPL_SYNC) .remoteTimeout(30000) .transaction().transactionMode(TransactionMode.TRANSACTIONAL) .invocationBatching().enable() .locking().lockAcquisitionTimeout(60000).useLockStriping(false); EmbeddedCacheManager container = TestCacheManagerFactory.createClusteredCacheManager(c); container.start(); registerCacheManager(container); container.defineConfiguration(TEST_CACHE, c.build()); container.startCaches(TEST_CACHE); Cache cache1 = container.getCache(TEST_CACHE); assert cache1.getCacheConfiguration().clustering().cacheMode().equals(CacheMode.REPL_SYNC); cache1.start(); container = TestCacheManagerFactory.createClusteredCacheManager(c); container.start(); registerCacheManager(container); container.defineConfiguration(TEST_CACHE, c.build()); container.startCaches(TEST_CACHE); Cache cache2 = container.getCache(TEST_CACHE); assert cache2.getCacheConfiguration().clustering().cacheMode().equals(CacheMode.REPL_SYNC); }