use of org.infinispan.configuration.global.GlobalConfigurationBuilder in project wildfly by wildfly.
the class JGroupsTransportBuilder method getValue.
@Override
public TransportConfiguration getValue() {
ChannelFactory factory = this.factory.getValue();
ProtocolStackConfiguration stack = factory.getProtocolStackConfiguration();
org.wildfly.clustering.jgroups.spi.TransportConfiguration.Topology topology = stack.getTransport().getTopology();
TransportConfigurationBuilder builder = new GlobalConfigurationBuilder().transport().clusterName(this.containerName).distributedSyncTimeout(this.lockTimeout).transport(new ChannelFactoryTransport(factory));
if (topology != null) {
builder.siteId(topology.getSite()).rackId(topology.getRack()).machineId(topology.getMachine());
}
return builder.create();
}
use of org.infinispan.configuration.global.GlobalConfigurationBuilder in project galley by Commonjava.
the class NFSOwnerCacheProducer method getCacheMgr.
public EmbeddedCacheManager getCacheMgr() {
final EmbeddedCacheManager cacheManager = new DefaultCacheManager(new GlobalConfigurationBuilder().globalJmxStatistics().jmxDomain("org.commonjava.maven.galley").build());
// Want to enable dead lock check as lock will be used in FastLocalCacheProvider
// and also set transaction mode to PESSIMISTIC with DummyTransactionManger.
final Configuration configurationForNfs = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LRU).size(1000).type(EvictionType.COUNT).deadlockDetection().spinDuration(10, TimeUnit.SECONDS).enable().transaction().transactionManagerLookup(new DummyTransactionManagerLookup()).lockingMode(LockingMode.PESSIMISTIC).build();
cacheManager.defineConfiguration(CACHE_NAME, configurationForNfs);
// Default cache impl for the local file cache in FLCP, uses 7 day as an expiration duration, and trigger purge every 30 mins.
final Long expirationDuration = 7 * 24 * 3600 * 1000L;
Configuration configForLocalFile = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LRU).size(20000).type(EvictionType.COUNT).expiration().lifespan(expirationDuration).wakeUpInterval(30 * 60 * 1000L).maxIdle(expirationDuration).build();
cacheManager.defineConfiguration(DEFAULT_LOCAL_CACHE_FILE_NAME, configForLocalFile);
// A test cache impl to do unit-testing for this local file cache expiration for purging mechanism
Configuration configForLocalFileTest = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LRU).size(1000).type(EvictionType.COUNT).expiration().lifespan(1000L).wakeUpInterval(100L).maxIdle(1000L).build();
cacheManager.defineConfiguration(LOCAL_CACHE_FILE_NAME_FOR_TEST, configForLocalFileTest);
return cacheManager;
}
use of org.infinispan.configuration.global.GlobalConfigurationBuilder in project indy by Commonjava.
the class ContentControllerTest method setupClass.
@BeforeClass
public static void setupClass() {
GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build();
cacheManager = new DefaultCacheManager(globalConfiguration, new ConfigurationBuilder().simpleCache(true).build());
contentMetadata = cacheManager.getCache("content-metadata", true);
}
use of org.infinispan.configuration.global.GlobalConfigurationBuilder in project gora by apache.
the class SimulationDriver method create.
// Helpers
protected void create(int nnodes, ConfigurationBuilder defaultBuilder) {
// Start Hot Rod servers at each site.
for (int j = 0; j < nnodes; j++) {
GlobalConfigurationBuilder gbuilder = GlobalConfigurationBuilder.defaultClusteredBuilder();
Transport transport = gbuilder.transport().getTransport();
gbuilder.transport().transport(transport);
gbuilder.transport().clusterName("test");
startHotRodServer(gbuilder, defaultBuilder, j + 1);
}
// Create appropriate caches at each node.
ConfigurationBuilder builder = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false));
builder.indexing().index(Index.LOCAL).addProperty("default.directory_provider", "ram").addProperty("hibernate.search.default.exclusive_index_use", "true").addProperty("hibernate.search.default.indexmanager", "near-real-time").addProperty("hibernate.search.default.indexwriter.ram_buffer_size", "128").addProperty("lucene_version", "LUCENE_CURRENT");
builder.clustering().hash().numOwners(1);
builder.jmxStatistics().enable();
builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);
Configuration configuration = builder.build();
for (int j = 0; j < nnodes; j++) {
for (String name : cacheNames) {
manager(j).defineConfiguration(name, configuration);
manager(j).getCache(name, true);
}
}
// Verify that default caches are started.
for (int j = 0; j < nnodes; j++) {
assert manager(j).getCache() != null;
}
// Verify that the default caches is running.
for (int j = 0; j < nnodes; j++) {
blockUntilCacheStatusAchieved(manager(j).getCache(), ComponentStatus.RUNNING, 10000);
}
for (int j = 0; j < nnodes; j++) {
if (j != 0)
connectionString += ";";
connectionString += server(j).getHost() + ":" + server(j).getPort();
}
}
use of org.infinispan.configuration.global.GlobalConfigurationBuilder in project wildfly by wildfly.
the class ChannelFactoryTransport method setConfiguration.
@Inject
@Override
public void setConfiguration(GlobalConfiguration config) {
GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder();
// WFLY-6685 Prevent Infinispan from registering channel mbeans
// The JGroups subsystem already does this
builder.globalJmxStatistics().read(config.globalJmxStatistics()).disable();
// ISPN-4755 workaround
TransportConfiguration transport = config.transport();
builder.transport().clusterName(transport.clusterName()).distributedSyncTimeout(transport.distributedSyncTimeout()).initialClusterSize(transport.initialClusterSize()).initialClusterTimeout(transport.initialClusterTimeout(), TimeUnit.MILLISECONDS).machineId(transport.machineId()).nodeName(transport.nodeName()).rackId(transport.rackId()).siteId(transport.siteId()).transport(transport.transport()).withProperties(transport.properties());
super.setConfiguration(builder.build());
}
Aggregations