@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); } }
protected void createCacheManagers() throws Throwable { ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); c.invocationBatching().enable(); createClusteredCaches(2, "atomic", c); }
@BeforeClass public void setUp() { ConfigurationBuilder c = new ConfigurationBuilder(); c.invocationBatching().enable(); cacheContainer = TestCacheManagerFactory.createCacheManager(c); cache = cacheContainer.getCache(); tm = TestingUtil.getTransactionManager(cache); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder configuration = new ConfigurationBuilder(); configuration.invocationBatching().enable(); enableTestJdbcStorage(configuration); return TestCacheManagerFactory.createCacheManager(configuration); }
@Override public EmbeddedCacheManager createCacheManager() { final ConfigurationBuilder defaultConfiguration = getDefaultCacheConfiguration(true); defaultConfiguration.invocationBatching().enable().transaction().autoCommit(false); return TestCacheManagerFactory.createCacheManager(defaultConfiguration); }
private <K, V> Cache<K, V> createCache(boolean enableBatch, String name) { ConfigurationBuilder c = new ConfigurationBuilder(); c.invocationBatching().enable(enableBatch); cacheManager.defineConfiguration(name, c.build()); return cacheManager.getCache(name); } }
protected <K, V> Cache<K, V> createCache(String name) { ConfigurationBuilder c = getDefaultCacheConfiguration(true); c.invocationBatching().enable(); cacheManager.defineConfiguration(name, c.build()); return cacheManager.getCache(name); } }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.invocationBatching().enable(); cb.transaction().transactionManagerLookup(null); return TestCacheManagerFactory.createCacheManager(cb); }
public void testAtomicMapWithoutBatchSet() { ConfigurationBuilder builder = buildConfiguration(); builder.invocationBatching().disable(); cacheManager.defineConfiguration("ahm_without_batch", builder.build()); Cache<String, String> ahmCache = cacheManager.getCache("ahm_without_batch"); AtomicMap<String, String> map = AtomicMapLookup.getAtomicMap(ahmCache, "key"); assert map.isEmpty(); map.put("a", "b"); assert map.get("a").equals("b"); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getAtomicMap(ahmCache, "key").get("a").equals("b"); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder dccc = getDefaultClusteredCacheConfig(CacheMode.LOCAL, false); dccc.transaction().transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC); dccc.invocationBatching().enable(true); return TestCacheManagerFactory.createCacheManager(dccc); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder c = getDefaultStandaloneCacheConfig(true); c.invocationBatching().enable().memory().storageType(StorageType.BINARY); EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(c); cache = cm.getCache(); return cm; }
public void testFineGrainedAtomicMapWithoutBatchSet() { ConfigurationBuilder builder = buildConfiguration(); builder.invocationBatching().disable(); cacheManager.defineConfiguration("fgahm_without_batch", builder.build()); Cache<String, String> fgahmCache = cacheManager.getCache("fgahm_without_batch"); FineGrainedAtomicMap<String, String> map = AtomicMapLookup.getFineGrainedAtomicMap(fgahmCache, "key"); assert map.isEmpty(); map.put("a", "b"); assert map.get("a").equals("b"); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getFineGrainedAtomicMap(fgahmCache, "key").get("a").equals("b"); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder cfg = getDefaultStandaloneCacheConfig(true); cfg .invocationBatching().enable() .persistence() .addStore(DummyInMemoryStoreConfigurationBuilder.class) .ignoreModifications(true); return TestCacheManagerFactory.createCacheManager(cfg); }
protected void createCacheManagers() throws Throwable { ConfigurationBuilder cb = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); cb.invocationBatching().enable(); createClusteredCaches(2, "replSync", cb); Cache c1 = cache(0, "replSync"); Cache c2 = cache(1, "replSync"); cache1 = new TreeCacheImpl<Object, Object>(c1); cache2 = new TreeCacheImpl<Object, Object>(c2); }
protected ConfigurationBuilder buildConfiguration() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.invocationBatching().enable(); builder.transaction().lockingMode(LockingMode.OPTIMISTIC); builder.clustering().hash().groups().enabled(); return builder; }
public void testInvocationBatchingAndInducedTm() { final ConfigurationBuilder cb = new ConfigurationBuilder(); cb.invocationBatching().enable(); assert cb.build().transaction().transactionMode().isTransactional(); withCacheManager(new CacheManagerCallable(TestCacheManagerFactory.createCacheManager(cb)){ @Override public void call() { assert cm.getCache().getAdvancedCache().getTransactionManager() != null; } }); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder cfg = getDefaultStandaloneCacheConfig(true); cfg .invocationBatching().enable() .persistence() .addStore(CountingStoreConfigurationBuilder.class) .persistence() .addStore(DummyInMemoryStoreConfigurationBuilder.class) .locking().isolationLevel(IsolationLevel.READ_COMMITTED); //avoid versioning since we are storing directly in CacheStore return TestCacheManagerFactory.createCacheManager(cfg); }
protected <K, V> Cache<K, V> createCache(String name) { ConfigurationBuilder c = new ConfigurationBuilder(); c.transaction().transactionManagerLookup(new MyDummyTransactionManagerLookup()); c.invocationBatching().enable(); c.transaction().transactionMode(TransactionMode.TRANSACTIONAL); cacheManager.defineConfiguration(name, c.build()); return cacheManager.getCache(name); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); builder.invocationBatching().enable(); builder.locking().isolationLevel(IsolationLevel.READ_COMMITTED); builder.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()).lockingMode(lockingMode); return TestCacheManagerFactory.createCacheManager(builder); }
public void testTransactionalityInduced() { ConfigurationBuilder cb = new ConfigurationBuilder(); Configuration c = cb.build(); assert !c.transaction().transactionMode().isTransactional(); c = cb.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()).build(); assert c.transaction().transactionMode().isTransactional(); cb = new ConfigurationBuilder(); cb.invocationBatching().enable(); assert cb.build().transaction().transactionMode().isTransactional(); }