本文整理了Java中org.infinispan.configuration.cache.Configuration.invocationBatching()
方法的一些代码示例,展示了Configuration.invocationBatching()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.invocationBatching()
方法的具体详情如下:
包路径:org.infinispan.configuration.cache.Configuration
类名称:Configuration
方法名:invocationBatching
暂无
代码示例来源:origin: org.infinispan/infinispan-cli-server
private void resetCache(final Cache<Object, Object> cache) {
if (cache.getCacheConfiguration().invocationBatching().enabled()) {
cache.endBatch(false);
}
TransactionManager tm = cache.getAdvancedCache().getTransactionManager();
try {
if (tm.getTransaction() != null) {
tm.rollback();
}
} catch (Exception e) {
}
}
代码示例来源:origin: org.infinispan/infinispan-cli-interpreter
private void resetCache(final Cache<Object, Object> cache) {
Configuration configuration = SecurityActions.getCacheConfiguration(cache.getAdvancedCache());
if (configuration.invocationBatching().enabled()) {
SecurityActions.endBatch(cache.getAdvancedCache());
}
TransactionManager tm = cache.getAdvancedCache().getTransactionManager();
try {
if (tm != null && tm.getTransaction() != null) {
tm.rollback();
}
} catch (Exception e) {
// Ignore the exception
}
}
代码示例来源:origin: org.infinispan/infinispan-tree
/**
* Creates a TreeCache instance by taking in a {@link org.infinispan.Cache} as a parameter
*
* @param cache
* @return instance of a {@link TreeCache}
* @throws NullPointerException if the cache parameter is null
* @throws CacheConfigurationException if the invocation batching configuration is not enabled.
*/
public <K, V> TreeCache<K, V> createTreeCache(Cache<K, V> cache) {
// Validation to make sure that the cache is not null.
if (cache == null) {
throw new NullPointerException("The cache parameter passed in is null");
}
// If invocationBatching is not enabled, throw a new configuration exception.
if (!cache.getCacheConfiguration().invocationBatching().enabled()) {
throw new CacheConfigurationException("invocationBatching is not enabled for cache '" +
cache.getName() + "'. Make sure this is enabled by" +
" calling configurationBuilder.invocationBatching().enable()");
}
return new TreeCacheImpl<K, V>(cache);
}
}
代码示例来源:origin: org.infinispan.server/infinispan-server-infinispan
cacheConfigurationDependencies.getTemplateConfigurationInjector());
if (config.invocationBatching().enabled()) {
cacheConfigurationDependencies.getTransactionManagerInjector().inject(BatchModeTransactionManager.getInstance());
} else if (config.transaction().transactionMode() == org.infinispan.transaction.TransactionMode.TRANSACTIONAL) {
代码示例来源:origin: org.infinispan/infinispan-core
public void testDefineConfigurationTwice() {
EmbeddedCacheManager cm = createCacheManager(false);
try {
Configuration override = new ConfigurationBuilder().invocationBatching().enable().build();
assertTrue(override.invocationBatching().enabled());
assertTrue(cm.defineConfiguration("test1", override).invocationBatching().enabled());
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.read(override);
Configuration config = cb.build();
assertTrue(config.invocationBatching().enabled());
assertTrue(cm.defineConfiguration("test2", config).invocationBatching().enabled());
} finally {
cm.stop();
}
}
代码示例来源:origin: org.infinispan/infinispan-core
public void testBatchingIsEnabled() throws Exception {
EmbeddedCacheManager cm = TestCacheManagerFactory.fromXml("configs/batching.xml");
try {
Cache c = cm.getCache("default");
assertTrue(c.getCacheConfiguration().invocationBatching().enabled());
assertTrue(c.getCacheConfiguration().transaction().transactionMode().isTransactional());
c = cm.getCache();
assertTrue(c.getCacheConfiguration().invocationBatching().enabled());
Cache c2 = cm.getCache("tml");
assertTrue(c2.getCacheConfiguration().transaction().transactionMode().isTransactional());
} finally {
cm.stop();
}
}
代码示例来源:origin: org.infinispan/infinispan-core
public void testBatchingAndTransactionalCache() {
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.invocationBatching().enable();
final Configuration c = cb.build();
assert c.invocationBatching().enabled();
assert c.transaction().transactionMode().isTransactional();
withCacheManager(new CacheManagerCallable(TestCacheManagerFactory.createCacheManager()) {
@Override
public void call() {
assert !cm.getCache().getCacheConfiguration().transaction().transactionMode().isTransactional();
cm.defineConfiguration("a", c);
final Cache<Object, Object> a = cm.getCache("a");
assert a.getCacheConfiguration().invocationBatching().enabled();
assert a.getCacheConfiguration().transaction().transactionMode().isTransactional();
}
});
}
}
代码示例来源:origin: org.infinispan/infinispan-core
@Override
public void call() {
assert !cm.getCache().getCacheConfiguration().transaction().transactionMode().isTransactional();
cm.defineConfiguration("a", c);
final Cache<Object, Object> a = cm.getCache("a");
assert a.getCacheConfiguration().invocationBatching().enabled();
assert a.getCacheConfiguration().transaction().transactionMode().isTransactional();
}
});
代码示例来源:origin: org.jboss.as/jboss-as-clustering-web-infinispan
@Override
public <T extends OutgoingDistributableSessionData> org.jboss.as.clustering.web.DistributedCacheManager<T> getDistributedCacheManager(LocalDistributableSessionManager manager) throws ClusteringNotSupportedException {
@SuppressWarnings("unchecked")
Registry<String, Void> jvmRouteRegistry = this.registry.getValue();
@SuppressWarnings("unchecked")
AdvancedCache<String, Map<Object, Object>> cache = this.cache.getValue().getAdvancedCache();
if (!cache.getCacheConfiguration().invocationBatching().enabled()) {
ServiceName cacheServiceName = this.getCacheServiceName(manager.getReplicationConfig());
throw new ClusteringNotSupportedException(MESSAGES.failedToConfigureWebApp(cacheServiceName.getParent().getSimpleName(), cacheServiceName.getSimpleName()));
}
BatchingManager batchingManager = new TransactionBatchingManager(cache.getTransactionManager());
SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), this.marshallerFactory.createMarshaller(manager));
return new DistributedCacheManager<T>(manager, new AtomicMapCache<String, Object, Object>(cache), jvmRouteRegistry, this.lockManager.getOptionalValue(), storage, batchingManager, this.invoker, this.affinityFactory.getValue());
}
代码示例来源:origin: org.infinispan/infinispan-core
assertFalse(c.invocationBatching().enabled());
assertTrue(c.jmxStatistics().enabled());
assertEquals(CacheMode.LOCAL, c.clustering().cacheMode());
assertTrue(c.invocationBatching().enabled());
assertTrue(c.jmxStatistics().enabled());
assertEquals(30500, c.locking().lockAcquisitionTimeout());
assertTrue(c.invocationBatching().enabled());
assertTrue(c.jmxStatistics().enabled());
assertEquals(31000, c.locking().lockAcquisitionTimeout());
assertFalse(c.invocationBatching().enabled());
assertEquals(1200000, c.clustering().l1().lifespan());
assertEquals(4, c.clustering().hash().numOwners());
assertEquals(CacheMode.REPL_SYNC, c.clustering().cacheMode());
assertTrue(c.invocationBatching().enabled());
assertEquals(CacheMode.REPL_SYNC, c.clustering().cacheMode());
assertTrue(c.invocationBatching().enabled());
assertEquals(CacheMode.REPL_SYNC, c.clustering().cacheMode());
assertTrue(c.invocationBatching().enabled());
内容来源于网络,如有侵权,请联系作者删除!