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 CacheStatisticManager(Configuration configuration, TimeService timeService) { this.timeService = timeService; this.isOptimisticLocking = configuration.transaction().lockingMode() == LockingMode.OPTIMISTIC; this.cacheStatisticCollector = new CacheStatisticCollector(timeService); }
@Override CacheRpcCommand buildRemoteCommand(Configuration configuration, CommandsFactory commandsFactory, TxState state) { if (configuration.transaction().lockingMode() == LockingMode.PESSIMISTIC) { //pessimistic locking commits in 1PC return commandsFactory.buildPrepareCommand(state.getGlobalTransaction(), state.getModifications(), true); } else if (Configurations.isTxVersioned(configuration)) { //TODO we don't support versioning yet (only used for optimistic tx). When we do, we need to store the versions in TxState. return commandsFactory.buildVersionedCommitCommand(state.getGlobalTransaction()); } else { return commandsFactory.buildCommitCommand(state.getGlobalTransaction()); } }
/** * 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 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()); }
if (commit) { TransactionBoundaryCommand rpcCommand; if (cr.getComponent(Configuration.class).transaction().lockingMode() == LockingMode.PESSIMISTIC) { rpcCommand = cr.getCommandsFactory() .buildPrepareCommand(state.getGlobalTransaction(), state.getModifications(), true);
assertTrue(c.transaction().transactionManagerLookup() instanceof TestLookup); assertEquals(10000, c.transaction().cacheStopTimeout()); assertEquals(LockingMode.PESSIMISTIC, c.transaction().lockingMode()); assertTrue(!c.transaction().autoCommit());
assertEquals(LockingMode.OPTIMISTIC, c.transaction().lockingMode()); assertTrue(c.transaction().transactionManagerLookup() instanceof JBossStandaloneJTAManagerLookup); assertEquals(60000, c.transaction().cacheStopTimeout()); assertEquals(LockingMode.OPTIMISTIC, c.transaction().lockingMode()); assertEquals(60500, c.transaction().cacheStopTimeout()); assertEquals(20500, c.memory().size()); assertEquals(LockingMode.PESSIMISTIC, c.transaction().lockingMode()); assertEquals(61000, c.transaction().cacheStopTimeout()); assertEquals(21000, c.memory().size()); assertEquals(LockingMode.OPTIMISTIC, c.transaction().lockingMode()); assertEquals(61500, c.transaction().cacheStopTimeout()); assertEquals(21500, c.memory().size()); assertEquals(LockingMode.PESSIMISTIC, c.transaction().lockingMode()); assertEquals(LockingMode.PESSIMISTIC, c.transaction().lockingMode()); fileStore = getStoreConfiguration(c, SingleFileStoreConfiguration.class); assertTrue(fileStore.preload());