strSubstitutor.replace(clusterAddress)); log.debug(" - cluster address: {}", configuration.getClusterAddress());
public InfinispanRemoteCacheManager(KiWiConfiguration configuration) { this.configuration = configuration; Configuration remoteCfg = new ConfigurationBuilder() .addServer() .host(configuration.getClusterAddress()) .port(configuration.getClusterPort()) .marshaller(new CustomJBossMarshaller()) .socketTimeout(configuration.getClusterTimeout()) .connectionTimeout(configuration.getClusterTimeout()) .build(); cacheManager = new RemoteCacheManager(remoteCfg); log.info("initialised Infinispan remote cache manager (servers: {})", configuration.getClusterAddress()); }
public HazelcastCacheManager(KiWiConfiguration configuration) { this.configuration = configuration; hcConfiguration = new Config(); if(configuration.isClustered()) { hcConfiguration.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(true); hcConfiguration.getNetworkConfig().getJoin().getMulticastConfig().setMulticastPort(configuration.getClusterPort()); hcConfiguration.getNetworkConfig().getJoin().getMulticastConfig().setMulticastGroup(configuration.getClusterAddress()); } else { hcConfiguration.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); } hcConfiguration.getGroupConfig().setName(configuration.getClusterName()); hcConfiguration.setClassLoader(HazelcastCacheManager.class.getClassLoader()); hcConfiguration.setProperty("hazelcast.logging.type", "slf4j"); setupSerializers(); setupCaches(); hazelcast = Hazelcast.newHazelcastInstance(hcConfiguration); if(!configuration.isClustered()) { log.info("initialised Hazelcast local cache manager"); } else { log.info("initialised Hazelcast distributed cache manager (cluster name: {})", configuration.getClusterName()); if(configuration.getCacheMode() != CacheMode.DISTRIBUTED) { log.warn("Hazelcast only supports distributed cache mode (mode configuration was {})", configuration.getCacheMode()); } } }
public HazelcastCacheManager(KiWiConfiguration configuration) { this.configuration = configuration; hcConfiguration = new Config(); if(configuration.isClustered()) { hcConfiguration.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(true); hcConfiguration.getNetworkConfig().getJoin().getMulticastConfig().setMulticastPort(configuration.getClusterPort()); hcConfiguration.getNetworkConfig().getJoin().getMulticastConfig().setMulticastGroup(configuration.getClusterAddress()); } else { hcConfiguration.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); } hcConfiguration.getGroupConfig().setName(configuration.getClusterName()); hcConfiguration.setClassLoader(HazelcastCacheManager.class.getClassLoader()); hcConfiguration.setProperty("hazelcast.logging.type", "slf4j"); setupSerializers(); setupCaches(); hazelcast = Hazelcast.newHazelcastInstance(hcConfiguration); if(!configuration.isClustered()) { log.info("initialised Hazelcast local cache manager"); } else { log.info("initialised Hazelcast distributed cache manager (cluster name: {})", configuration.getClusterName()); if(configuration.getCacheMode() != CacheMode.DISTRIBUTED) { log.warn("Hazelcast only supports distributed cache mode (mode configuration was {})", configuration.getCacheMode()); } } }
String jgroupsXml = IOUtils.toString(InfinispanEmbeddedCacheManager.class.getResourceAsStream("/jgroups-kiwi.xml")); jgroupsXml = jgroupsXml.replaceAll("mcast_addr=\"[0-9.]+\"", String.format("mcast_addr=\"%s\"", config.getClusterAddress())); jgroupsXml = jgroupsXml.replaceAll("mcast_port=\"[0-9]+\"", String.format("mcast_port=\"%d\"", config.getClusterPort()));
String jgroupsXml = IOUtils.toString(InfinispanEmbeddedCacheManager.class.getResourceAsStream("/jgroups-kiwi.xml")); jgroupsXml = jgroupsXml.replaceAll("mcast_addr=\"[0-9.]+\"", String.format("mcast_addr=\"%s\"", config.getClusterAddress())); jgroupsXml = jgroupsXml.replaceAll("mcast_port=\"[0-9]+\"", String.format("mcast_port=\"%d\"", config.getClusterPort()));