private void parseInvocationBatching(final XMLExtendedStreamReader reader, final ConfigurationBuilderHolder holder) throws XMLStreamException { ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder(); for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = replaceProperties(reader.getAttributeValue(i)); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case ENABLED: if (Boolean.parseBoolean(value)) { builder.invocationBatching().enable(); } else { builder.invocationBatching().disable(); } break; default: throw ParseUtils.unexpectedAttribute(reader, i); } } ParseUtils.requireNoContent(reader); }
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"); }
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"); }
@Test(expectedExceptions = IllegalStateException.class) public void testFineGrainedAtomicMapNonTransactionWithoutBatchSet() { ConfigurationBuilder builder = buildConfiguration(); builder.invocationBatching().disable(); builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); cacheManager.defineConfiguration("fgahm_no_tx_without_batch", builder.build()); Cache<String, String> fgahmCache = cacheManager.getCache("fgahm_no_tx_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"); }
public void testAtomicMapNonTransactionWithoutBatchSet() { ConfigurationBuilder builder = buildConfiguration(); builder.invocationBatching().disable(); builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); cacheManager.defineConfiguration("ahm_no_tx_without_batch", builder.build()); Cache<String, String> ahmCache = cacheManager.getCache("ahm_no_tx_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 void createCacheManagers() throws Throwable { ConfigurationBuilder cb = AbstractCacheTest.getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); cb.invocationBatching().disable(); TransportFlags transportFlags = new TransportFlags().withMerge(true); writingNode = addClusterEnabledCacheManager(cb, transportFlags); for (int i = 0; i < READERS; i++) { readers[i] = addClusterEnabledCacheManager(cb, transportFlags); Cache<Object, Object> cache = readers[i].getCache(); discardPerNode[i] = TestingUtil.getDiscardForCache(readers[i]); TestingUtil.setDelayForCache(cache, 1, 1); TestingUtil.blockUntilViewReceived(cache, i + 1); } }
builder.transaction().transactionMode(org.infinispan.transaction.TransactionMode.TRANSACTIONAL).invocationBatching().enable(); } else { builder.transaction().invocationBatching().disable();
public static ConfigurationBuilder createLocalCacheConfiguration() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder .clustering() .cacheMode(CacheMode.LOCAL) .transaction() .transactionMode(TransactionMode.NON_TRANSACTIONAL) .locking() .lockAcquisitionTimeout(10000) .invocationBatching() .disable() .deadlockDetection() .disable() .jmxStatistics() .disable() ; return builder; }
private EmbeddedCacheManager getCacheManager(boolean batchingEnabled) throws Exception { ConfigurationBuilder builder = new ConfigurationBuilder(); builder .persistence() .passivation(false) .addSingleFileStore() .location(TMP_DIR + File.separator + "cacheStore") .preload(false) .fetchPersistentState(true) .purgeOnStartup(false) .indexing() .index(Index.PRIMARY_OWNER) .addIndexedEntity(SEntity.class) .addProperty("default.directory_provider", "filesystem") .addProperty("lucene_version", "LUCENE_CURRENT") .addProperty("default.indexBase", TMP_DIR + File.separator + "idx"); if (batchingEnabled) { builder.invocationBatching().enable(); } else { builder.invocationBatching().disable(); } return TestCacheManagerFactory.createCacheManager(builder); }
public static ConfigurationBuilder createTestConfiguration(TransactionMode transactionMode) { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder .clustering() .cacheMode(CacheMode.DIST_SYNC) .remoteTimeout(10000) .stateTransfer() .fetchInMemoryState(true) .l1() .enable() .transaction() .transactionMode(transactionMode) .locking() .lockAcquisitionTimeout(10000) .invocationBatching() .disable() .deadlockDetection() .disable() .jmxStatistics() .disable() ; return builder; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder configurationBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); configurationBuilder .clustering() .cacheMode(CacheMode.DIST_SYNC) .remoteTimeout(10000) .stateTransfer() .fetchInMemoryState(true) .l1() .enable() .transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .locking() .lockAcquisitionTimeout(10000) .invocationBatching() .disable() .jmxStatistics() .disable() .indexing() .index(Index.ALL) .addIndexedEntity(Person.class) .addProperty("hibernate.search.default.directory_provider", "local-heap") .addProperty("lucene_version", "LUCENE_CURRENT"); createClusteredCaches(2, "lucene", configurationBuilder); }