@Override public LockingConfiguration get() { return new ConfigurationBuilder().locking() .lockAcquisitionTimeout(this.timeout) .concurrencyLevel(this.concurrency) .isolationLevel(this.isolation) .useLockStriping(this.striping) .create(); }
@Override protected void enhanceConfiguration(ConfigurationBuilder builder) { builder.locking().isolationLevel(IsolationLevel.READ_COMMITTED); } }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); c.transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .lockingMode(LockingMode.PESSIMISTIC) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); c.clustering().hash().numOwners(1).groups().enabled(); createClusteredCaches(2, "atomic", c); } }
@BeforeMethod public void setUp() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.invocationBatching().enable() .clustering().cacheMode(CacheMode.LOCAL) .locking().concurrencyLevel(2000) .lockAcquisitionTimeout(120000) .isolationLevel(IsolationLevel.READ_COMMITTED); cacheContainer = TestCacheManagerFactory.createCacheManager(cb); Cache c = cacheContainer.getCache(); cache = new TreeCacheImpl<>(c); }
@Override protected ConfigurationBuilder createConfigurationBuilder() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.invocationBatching().enable() .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .isolationLevel(IsolationLevel.REPEATABLE_READ) .transaction().lockingMode(LockingMode.PESSIMISTIC); return cb; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder c = new ConfigurationBuilder(); c .locking() .isolationLevel(IsolationLevel.READ_COMMITTED) .lockAcquisitionTimeout(60000) .useLockStriping(false) .clustering() .cacheMode(CacheMode.DIST_SYNC) .remoteTimeout(30000) .l1().disable() .transaction() .lockingMode(LockingMode.PESSIMISTIC) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()); GlobalConfigurationBuilder gc = GlobalConfigurationBuilder.defaultClusteredBuilder(); gc.transport().distributedSyncTimeout(60000); List<EmbeddedCacheManager> cacheManagers = new LinkedList<>(); for (int i = 0; i < NUM_NODES; i++) cacheManagers.add(createClusteredCacheManager(gc, c)); registerCacheManager(cacheManagers.toArray(new EmbeddedCacheManager[NUM_NODES])); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder config = getDefaultStandaloneCacheConfig(true); config .transaction().lockingMode(LockingMode.PESSIMISTIC) .locking().useLockStriping(false).lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(config); cache = cm.getCache(); return cm; }
private ConfigurationBuilder configuration() { ConfigurationBuilder configurationBuilder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); configurationBuilder.transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .lockingMode(LockingMode.OPTIMISTIC) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .isolationLevel(IsolationLevel.REPEATABLE_READ) .clustering().hash().numOwners(2).groups().enabled() .stateTransfer().fetchInMemoryState(false); return configurationBuilder; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder configuration = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); configuration.locking() .useLockStriping(false) .isolationLevel(IsolationLevel.READ_COMMITTED) .lockAcquisitionTimeout(20000); configuration.transaction() .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .lockingMode(LockingMode.PESSIMISTIC) .useSynchronization(false) .recovery() .disable(); configuration.clustering() .hash() .numSegments(60) .stateTransfer() .fetchInMemoryState(false); viewLatch = new CountDownLatch(1); GlobalConfigurationBuilder global = new GlobalConfigurationBuilder(); global.transport().transport(new DelayedViewJGroupsTransport(viewLatch)); addClusterEnabledCacheManager(global, configuration); addClusterEnabledCacheManager(configuration); addClusterEnabledCacheManager(configuration); }
protected ConfigurationBuilder createConfigurationBuilder() { ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); configurationBuilder .transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .locking() .lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .isolationLevel(IsolationLevel.REPEATABLE_READ); return configurationBuilder; }
.clustering().cacheMode(CacheMode.REPL_SYNC).remoteTimeout(25000) .stateTransfer().awaitInitialTransfer(true).timeout(480000) .locking().useLockStriping(false).lockAcquisitionTimeout(10000).concurrencyLevel(500) .clustering().cacheMode(CacheMode.DIST_SYNC).remoteTimeout(25000) .stateTransfer().awaitInitialTransfer(true).timeout(480000) .locking().useLockStriping(false).lockAcquisitionTimeout(10000).concurrencyLevel(500) .clustering().cacheMode(CacheMode.REPL_SYNC).remoteTimeout(25000) .stateTransfer().awaitInitialTransfer(true).timeout(480000) .locking().useLockStriping(false).lockAcquisitionTimeout(10000).concurrencyLevel(500)
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); c.transaction().lockingMode(LockingMode.PESSIMISTIC) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); List<Cache<String, String>> caches = createClusteredCaches(2, "tx", c); c1 = caches.get(0); c2 = caches.get(1); }
public MetadataManager(DefaultCacheManager cacheManager){ Configuration cacheConfiguration = cacheManager.getCacheConfiguration(Support.AVRO_METADATA_CACHE_NAME); if (cacheConfiguration == null) { ConfigurationBuilder cfg = new ConfigurationBuilder(); CacheMode cacheMode = cacheManager.getDefaultCacheConfiguration().clustering().cacheMode().equals(CacheMode.LOCAL) ? CacheMode.LOCAL : CacheMode.REPL_SYNC; cfg .transaction().lockingMode(LockingMode.PESSIMISTIC).syncCommitPhase(true).syncRollbackPhase(true) .persistence().addSingleFileStore().location(System.getProperty("java.io.tmpdir") + "/" + cacheManager.getNodeAddress()) // mandatory .locking().isolationLevel(IsolationLevel.READ_COMMITTED).useLockStriping(false) .clustering().cacheMode(cacheMode) .stateTransfer().fetchInMemoryState(true) .dataContainer().keyEquivalence(new ByteArrayEquivalence()); // for HotRod compatibility if (cacheMode.equals(CacheMode.REPL_SYNC)) cfg.clustering().stateTransfer().awaitInitialTransfer(true); cacheManager.defineConfiguration(Support.AVRO_METADATA_CACHE_NAME, cfg.build()); this.cacheManager = cacheManager; this.marshaller= Externalizer.getInstance(); this.knownSchemas = new ConcurrentHashMap<>(); knownSchemas.put(Request.getClassSchema().getFullName(), Request.getClassSchema()); knownSchemas.put(Response.getClassSchema().getFullName(), Response.getClassSchema()); } }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.LOCAL, true, true); builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .memory().storageType(StorageType.BINARY).size(150) .locking().useLockStriping(false).isolationLevel(IsolationLevel.READ_COMMITTED) .persistence() .passivation(passivationEnabled) .addStore(DummyInMemoryStoreConfigurationBuilder.class) .storeName(getClass().getName()) .fetchPersistentState(true) .ignoreModifications(false) .preload(false) .purgeOnStartup(false); return TestCacheManagerFactory.createCacheManager(builder); }
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); }
private ConfigurationBuilder makeCfg() { ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg.transaction() .transactionMode(TransactionMode.TRANSACTIONAL).invocationBatching().enable() .clustering().cacheMode(CacheMode.REPL_SYNC) .clustering().sync() .stateTransfer().fetchInMemoryState(true) .transaction().lockingMode(LockingMode.PESSIMISTIC) .locking().isolationLevel(IsolationLevel.READ_COMMITTED).useLockStriping(false) .customInterceptors().addInterceptor() .interceptor(new ProtobufMetadataManagerInterceptor()).after(PessimisticLockingInterceptor.class); return cfg; }
public void testNoneIsolationLevelInCluster() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.locking().isolationLevel(IsolationLevel.NONE) .clustering().cacheMode(CacheMode.REPL_SYNC).build(); withCacheManager(new CacheManagerCallable( TestCacheManagerFactory.createClusteredCacheManager(builder)) { @Override public void call() { Configuration cfg = cm.getCache().getCacheConfiguration(); assertEquals(IsolationLevel.READ_COMMITTED, cfg.locking().isolationLevel()); } }); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { cacheManager = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(JMX_DOMAIN); ConfigurationBuilder configuration = getDefaultStandaloneCacheConfig(true); configuration .jmxStatistics().enable() .locking() .concurrencyLevel(CONCURRENCY_LEVEL) .useLockStriping(true) .transaction() .transactionManagerLookup(new EmbeddedTransactionManagerLookup()); cacheManager.defineConfiguration("test", configuration.build()); cache = cacheManager.getCache("test"); lockManagerObjName = getCacheObjectName(JMX_DOMAIN, "test(local)", "LockManager"); threadMBeanServer = PerThreadMBeanServerLookup.getThreadMBeanServer(); return cacheManager; }
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 ConfigurationBuilder defaultRecoveryConfig() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); builder.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .useSynchronization(false) .recovery().enable() .locking().useLockStriping(false) .clustering().hash().numOwners(2) .l1().disable() .stateTransfer().fetchInMemoryState(false); return builder; }