Search in sources :

Example 1 with GlobalConfigurationBuilder

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();
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) TransportConfigurationBuilder(org.infinispan.configuration.global.TransportConfigurationBuilder) ProtocolStackConfiguration(org.wildfly.clustering.jgroups.spi.ProtocolStackConfiguration) TransportConfiguration(org.infinispan.configuration.global.TransportConfiguration) ChannelFactory(org.wildfly.clustering.jgroups.spi.ChannelFactory) ChannelFactoryTransport(org.jboss.as.clustering.infinispan.ChannelFactoryTransport)

Example 2 with GlobalConfigurationBuilder

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;
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) DummyTransactionManagerLookup(org.infinispan.transaction.lookup.DummyTransactionManagerLookup) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) Configuration(org.infinispan.configuration.cache.Configuration) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 3 with GlobalConfigurationBuilder

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);
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) GlobalConfiguration(org.infinispan.configuration.global.GlobalConfiguration) BeforeClass(org.junit.BeforeClass)

Example 4 with GlobalConfigurationBuilder

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();
    }
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) HotRodTestingUtil.hotRodCacheConfiguration(org.infinispan.server.hotrod.test.HotRodTestingUtil.hotRodCacheConfiguration) Configuration(org.infinispan.configuration.cache.Configuration) Transport(org.infinispan.remoting.transport.Transport)

Example 5 with GlobalConfigurationBuilder

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());
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) TransportConfiguration(org.infinispan.configuration.global.TransportConfiguration) Inject(org.infinispan.factories.annotations.Inject)

Aggregations

GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)11 DefaultCacheManager (org.infinispan.manager.DefaultCacheManager)6 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)4 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)4 TransportConfiguration (org.infinispan.configuration.global.TransportConfiguration)3 Configuration (org.infinispan.configuration.cache.Configuration)2 TransportConfigurationBuilder (org.infinispan.configuration.global.TransportConfigurationBuilder)2 ConfigurationBuilderHolder (org.infinispan.configuration.parsing.ConfigurationBuilderHolder)2 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)2 ChannelFactory (org.wildfly.clustering.jgroups.spi.ChannelFactory)2 ProtocolStackConfiguration (org.wildfly.clustering.jgroups.spi.ProtocolStackConfiguration)2 IOException (java.io.IOException)1 Serializable (java.io.Serializable)1 PrivilegedActionException (java.security.PrivilegedActionException)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Properties (java.util.Properties)1