Search in sources :

Example 1 with Transport

use of org.infinispan.remoting.transport.Transport 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)

Aggregations

Configuration (org.infinispan.configuration.cache.Configuration)1 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)1 Transport (org.infinispan.remoting.transport.Transport)1 HotRodTestingUtil.hotRodCacheConfiguration (org.infinispan.server.hotrod.test.HotRodTestingUtil.hotRodCacheConfiguration)1