public InfinispanCacheProperties(Configuration config) { this.transactional = config.transaction().transactionMode().isTransactional(); this.lockOnWrite = this.transactional && (config.transaction().lockingMode() == LockingMode.PESSIMISTIC); this.lockOnRead = this.lockOnWrite && (config.locking().isolationLevel() == IsolationLevel.REPEATABLE_READ); boolean clustered = config.clustering().cacheMode().needsStateTransfer(); boolean hasStore = config.persistence().usingStores(); this.marshalling = clustered || hasStore; this.persistent = clustered || (hasStore && !config.persistence().passivation()); }
@Override public void call() { Configuration cfg = cm.getCache().getCacheConfiguration(); assertEquals(IsolationLevel.NONE, cfg.locking().isolationLevel()); } });
@Override public void call() { Configuration cfg = cm.getCache().getCacheConfiguration(); assertEquals(IsolationLevel.READ_COMMITTED, cfg.locking().isolationLevel()); } });
/** * Checks if the configuration (and the transaction manager) is able to handle client transactions. */ private void validateConfiguration(AdvancedCache<byte[], byte[]> cache) { Configuration configuration = cache.getCacheConfiguration(); if (!configuration.transaction().transactionMode().isTransactional()) { throw log.expectedTransactionalCache(cache.getName()); } if (configuration.locking().isolationLevel() != IsolationLevel.REPEATABLE_READ) { throw log.unexpectedIsolationLevel(cache.getName()); } //TODO because of ISPN-7672, optimistic and total order transactions needs versions. however, versioning is currently broken if (configuration.transaction().lockingMode() == LockingMode.OPTIMISTIC || configuration.transaction().transactionProtocol() == TransactionProtocol.TOTAL_ORDER) { //no Log. see comment above throw new IllegalStateException( String.format("Cache '%s' cannot use Optimistic neither Total Order transactions.", cache.getName())); } }
public void testNullFoundButLoaderReceivedValueLaterInTransaction() throws SystemException, NotSupportedException { assertNotInCacheAndStore("k1"); tm.begin(); try { assertNull(cache.get("k1")); // Now simulate that someone else wrote to the store while during our tx store.write(new MarshalledEntryImpl("k1", "v1", null, sm)); IsolationLevel level = cache.getCacheConfiguration().locking().isolationLevel(); switch(level) { case READ_COMMITTED: assertEquals("v1", cache.get("k1")); break; case REPEATABLE_READ: assertNull(cache.get("k1")); break; default: fail("Unsupported isolation " + level + " - please change test to add desired outcome for isolation level"); } } finally { tm.rollback(); } }
@Override public void call() { Configuration cfg = cm.getDefaultCacheConfiguration(); assertEquals(10000, cfg.locking().concurrencyLevel()); assertEquals(IsolationLevel.REPEATABLE_READ, cfg.locking().isolationLevel()); }
public InfinispanCacheProperties(Configuration config) { this.transactional = config.transaction().transactionMode().isTransactional(); this.lockOnWrite = this.transactional && (config.transaction().lockingMode() == LockingMode.PESSIMISTIC); this.lockOnRead = this.lockOnWrite && (config.locking().isolationLevel() == IsolationLevel.REPEATABLE_READ); boolean clustered = config.clustering().cacheMode().needsStateTransfer(); boolean hasStore = config.persistence().usingStores(); this.marshalling = clustered || hasStore; this.persistent = clustered || (hasStore && !config.persistence().passivation()); }
public InfinispanCacheProperties(Configuration config) { this.transactional = config.transaction().transactionMode().isTransactional(); this.lockOnWrite = this.transactional && (config.transaction().lockingMode() == LockingMode.PESSIMISTIC); this.lockOnRead = this.lockOnWrite && (config.locking().isolationLevel() == IsolationLevel.REPEATABLE_READ); boolean clustered = config.clustering().cacheMode().needsStateTransfer(); boolean hasStore = config.persistence().usingStores(); this.marshalling = clustered || hasStore; this.persistent = clustered || (hasStore && !config.persistence().passivation()); }
assertSize(cache2, 0); if (cache1.getCacheConfiguration().locking().isolationLevel() != IsolationLevel.REPEATABLE_READ || cache2.getCacheConfiguration().locking().isolationLevel() != IsolationLevel.REPEATABLE_READ) {
unblocked = true; if ( IsolationLevel.REPEATABLE_READ.equals( cache.getCacheConfiguration().locking().isolationLevel() ) ) { assertEquals( VALUE1, callWithSession(sessionFactory, session -> TEST_SESSION_ACCESS.fromRegion(region).get( session, KEY )) );
public void testGlobalConfig() throws Exception { ConfigurationBuilderHolder holder = parse(); GlobalConfiguration gc = holder.getGlobalConfigurationBuilder().build(); BlockingThreadPoolExecutorFactory listenerThreadPool = gc.listenerThreadPool().threadPoolFactory(); assertEquals(2, listenerThreadPool.maxThreads()); BlockingThreadPoolExecutorFactory persistenceThreadPool = gc.persistenceThreadPool().threadPoolFactory(); assertEquals(4, persistenceThreadPool.maxThreads()); Properties transportProps = gc.transport().properties(); assertEquals("jgroups-tcp.xml", transportProps.get("configurationFile")); Configuration configuration = holder.getDefaultConfigurationBuilder().build(); assertEquals(IsolationLevel.READ_COMMITTED, configuration.locking().isolationLevel()); } }
assertEquals(IsolationLevel.REPEATABLE_READ, defaultCfg.locking().isolationLevel()); if (!deprecated) { assertReaperAndTimeoutInfo(defaultCfg); assertEquals(20000, c.locking().lockAcquisitionTimeout()); assertEquals(1000, c.locking().concurrencyLevel()); assertEquals(IsolationLevel.REPEATABLE_READ, c.locking().isolationLevel()); assertEquals(StorageType.OBJECT, c.memory().storageType());
assertEquals(30000, c.locking().lockAcquisitionTimeout()); assertEquals(2000, c.locking().concurrencyLevel()); assertEquals(IsolationLevel.NONE, c.locking().isolationLevel()); assertTrue(c.locking().useLockStriping()); assertEquals(30500, c.locking().lockAcquisitionTimeout()); assertEquals(2500, c.locking().concurrencyLevel()); assertEquals(IsolationLevel.READ_COMMITTED, c.locking().isolationLevel()); // Converted to READ_COMMITTED by builder assertTrue(c.locking().useLockStriping()); assertEquals(31000, c.locking().lockAcquisitionTimeout()); assertEquals(3000, c.locking().concurrencyLevel()); assertEquals(IsolationLevel.REPEATABLE_READ, c.locking().isolationLevel()); // Converted to REPEATABLE_READ by builder assertTrue(c.locking().useLockStriping()); assertEquals(31500, c.locking().lockAcquisitionTimeout()); assertEquals(3500, c.locking().concurrencyLevel()); assertEquals(IsolationLevel.READ_COMMITTED, c.locking().isolationLevel()); assertTrue(c.locking().useLockStriping()); assertEquals(IsolationLevel.REPEATABLE_READ, c.locking().isolationLevel()); assertTrue(c.versioning().enabled()); assertEquals(VersioningScheme.SIMPLE, c.versioning().scheme());