final SingleFileStoreConfigurationBuilder fileStore = new SingleFileStoreConfigurationBuilder(persistConfig).location(location); fileStore.invocationBatching().enable(); fileStore.eviction().maxEntries(15); fileStore.eviction().strategy(EvictionStrategy.LRU);
@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); }
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); }
@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); } }
@Test(expectedExceptions = CacheConfigurationException.class, expectedExceptionsMessageRegExp = "ISPN(\\d)*: Cannot enable Invocation Batching when the Transaction Mode is NON_TRANSACTIONAL, set the transaction mode to TRANSACTIONAL") public void testInvocationBatchingAndNonTransactional() throws Exception { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.transaction() .transactionMode(NON_TRANSACTIONAL) .invocationBatching() .enable(); withCacheManager(new CacheManagerCallable(createCacheManager(cb))); }
@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; }
@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); }
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 { // start a single cache instance ConfigurationBuilder cb = getDefaultStandaloneCacheConfig(true); cb.invocationBatching().enable(); addCacheStore(cb.persistence()); EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(cb); cache = new TreeCacheImpl<String, String>(cm.getCache()); store = extractCacheStore(); return cm; }
@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); }
private ConfigurationBuilder buildCfg() { ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg .persistence() .passivation(true) .addStore(DummyInMemoryStoreConfigurationBuilder.class).purgeOnStartup(true) .invocationBatching().enable() .memory().storageType(storage); cfg.memory().size(EVICTION_MAX_ENTRIES); return 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); }
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(); }