@Override public LockingConfiguration get() { return new ConfigurationBuilder().locking() .lockAcquisitionTimeout(this.timeout) .concurrencyLevel(this.concurrency) .isolationLevel(this.isolation) .useLockStriping(this.striping) .create(); }
@Override public void accept(ConfigurationBuilder builder) { TransactionConfiguration tx = this.transaction.get(); builder.memory().read(this.memory.get()); builder.expiration().read(this.expiration.get()); builder.locking().read(this.locking.get()); builder.persistence().read(this.persistence.get()); builder.transaction().read(tx); builder.jmxStatistics().enabled(this.statisticsEnabled).available(this.statisticsEnabled); try { // Configure invocation batching based on transaction configuration builder.invocationBatching().enable(tx.transactionMode().isTransactional() && (tx.transactionManagerLookup().getTransactionManager() != ContextTransactionManager.getInstance())); } catch (Exception e) { throw new CacheException(e); } }
@Override protected ConfigurationBuilder buildConfiguration() { ConfigurationBuilder builder = super.buildConfiguration(); builder.locking().isolationLevel(isolationLevel); return builder; }
@Override void configure(ConfigurationBuilder builder) { builder.locking().useLockStriping(false); builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL); } },
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg.locking().useLockStriping(false); return TestCacheManagerFactory.createCacheManager(cfg); }
protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); builder.locking().isolationLevel(IsolationLevel.SERIALIZABLE) // TODO: Another case of default values changed (see ISPN-2651) .transaction().useSynchronization(false); List<Cache<Object, Object>> caches = createClusteredCaches(2, "cache", builder); cache1 = caches.get(0); cache2 = caches.get(1); }
public void testNoneIsolationLevel() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.locking().isolationLevel(IsolationLevel.NONE); withCacheManager(new CacheManagerCallable( createCacheManager(builder)) { @Override public void call() { Configuration cfg = cm.getCache().getCacheConfiguration(); assertEquals(IsolationLevel.NONE, cfg.locking().isolationLevel()); } }); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder dcc = getDefaultClusteredCacheConfig(mode, true); dcc.locking().isolationLevel(IsolationLevel.REPEATABLE_READ); createCluster(dcc, clusterSize); waitForClusterToForm(); }
private ConfigurationBuilder getBaseCfg() { ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg.locking().concurrencyLevel(5000).transaction().transactionManagerLookup(new JBossStandaloneJTAManagerLookup()); return cfg; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ); builder.clustering().hash().numOwners(1); createClusteredCaches(2, builder); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.LOCAL); builder.locking().lockAcquisitionTimeout(100, TimeUnit.MILLISECONDS); EmbeddedCacheManager cacheManager = TestCacheManagerFactory.createCacheManager(builder); for (CacheName cacheName : CacheName.values()) { cacheName.configure(builder); cacheManager.defineConfiguration(cacheName.name(), builder.build()); } return cacheManager; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(cacheMode, true); builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ); builder.transaction().lockingMode(lockingMode); builder.clustering().hash().numOwners(1); createClusteredCaches(2, builder); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); builder.locking() .isolationLevel(IsolationLevel.READ_COMMITTED); //read committed is enough builder.transaction() .lockingMode(LockingMode.PESSIMISTIC); builder.clustering().hash() .numOwners(2); createClusteredCaches(3, builder); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder dcc = getDefaultClusteredCacheConfig(CacheMode.LOCAL, false); dcc.memory().storageType(StorageType.OFF_HEAP).size(COUNT).evictionType(EvictionType.COUNT); dcc.locking().isolationLevel(IsolationLevel.READ_COMMITTED); // Only start up the 1 cache addClusterEnabledCacheManager(dcc); configureTimeService(); }
protected ConfigurationBuilder getConfigurationBuilder() { ConfigurationBuilder c = new ConfigurationBuilder(); c.clustering().cacheMode(cacheMode); c.transaction().transactionMode(transactionMode()); if (lockingMode != null) { c.transaction().lockingMode(lockingMode); } c.locking().isolationLevel(IsolationLevel.READ_COMMITTED); return c; }
private ConfigurationBuilder configuration() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); builder.clustering() .stateTransfer().fetchInMemoryState(true) .hash().numSegments(1).numOwners(3).consistentHashFactory(new ConsistentHashFactoryImpl()); builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ); return builder; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder cfg = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); cfg .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .transaction().lockingMode(LockingMode.PESSIMISTIC); EmbeddedCacheManager cm1 = TestCacheManagerFactory.createClusteredCacheManager(cfg); EmbeddedCacheManager cm2 = TestCacheManagerFactory.createClusteredCacheManager(cfg); registerCacheManager(cm1, cm2); c1 = cm1.getCache(); c2 = cm2.getCache(); }
private ConfigurationBuilder getClusteredCfg(CacheMode mode, boolean l1) { ConfigurationBuilder cfg = getBaseCfg(); cfg .locking().lockAcquisitionTimeout(60000) .clustering().cacheMode(mode).remoteTimeout(60000).stateTransfer().fetchInMemoryState(false); if (mode.isDistributed()) { cfg.clustering().l1().enabled(l1).lifespan(120000); } return cfg; }
protected void createCacheManagers() throws Throwable { configurationBuilder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); configurationBuilder.transaction() .lockingMode(LockingMode.PESSIMISTIC) .useSynchronization(false) .recovery().disable(); configurationBuilder.clustering().remoteTimeout(30000); configurationBuilder.clustering().stateTransfer().chunkSize(20); configurationBuilder.locking().useLockStriping(false); // reduces the odd chance of a key collision and deadlock }
@Override protected void createCacheManagers() throws Throwable { dccc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true, true); dccc.transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .lockingMode(LockingMode.PESSIMISTIC); dccc.clustering().hash().numOwners(1).l1().disable(); dccc.locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); createCluster(dccc, CLUSTER_SIZE); waitForClusterToForm(); }