protected boolean isClustered() { return config.getCacheMode() == org.apache.marmotta.kiwi.config.CacheMode.DISTRIBUTED || config.getCacheMode() == org.apache.marmotta.kiwi.config.CacheMode.REPLICATED; }
+ ")!"); log.debug(" - cache mode: {}",configuration.getCacheMode()); } else { // not clustered log.debug(" - no cluster configured");
/** * Create a new cache manager with its own automatically created Infinispan instance. * * @param config */ public InfinispanEmbeddedCacheManager(KiWiConfiguration config) { this.config = config; try { switch (config.getCacheMode()) { case DISTRIBUTED: buildDistributedConfiguration(getExternalizers()); break; case REPLICATED: buildReplicatedConfiguration(getExternalizers()); break; case LOCAL: buildLocalConfiguration(); break; } } catch (IOException ex) { log.warn("error while building cache cluster configuration, reverting to local cache"); buildLocalConfiguration(); } }
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()); } } }