Commit e1968c5b authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch 'master' into staging

parents d85094e0 a8b0744a
...@@ -34,8 +34,19 @@ import com.hazelcast.spring.context.SpringManagedContext; ...@@ -34,8 +34,19 @@ import com.hazelcast.spring.context.SpringManagedContext;
@EnableCaching @EnableCaching
@Import({ HazelcastConfigDev.class, HazelcastConfigAWS.class }) @Import({ HazelcastConfigDev.class, HazelcastConfigAWS.class })
public abstract class HazelcastConfig { public abstract class HazelcastConfig {
/// Interfaces on which HZ should bind
@Value("${hazelcast.interfaces}")
protected String hazelInterfaces;
/// TCP port to listen on
@Value("${hazelcast.port}") @Value("${hazelcast.port}")
protected int hazelPort; protected int hazelPort;
/// The public address (in case of NAT)
@Value("${hazelcast.publicAddress}")
protected String hazelPublicAddress;
@Value("${hazelcast.instanceName}") @Value("${hazelcast.instanceName}")
protected String instanceName; protected String instanceName;
@Value("${hazelcast.password}") @Value("${hazelcast.password}")
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.genesys2.spring.config; package org.genesys2.spring.config;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -67,6 +68,18 @@ public class HazelcastConfigAWS extends HazelcastConfig { ...@@ -67,6 +68,18 @@ public class HazelcastConfigAWS extends HazelcastConfig {
network.setPort(hazelPort); network.setPort(hazelPort);
network.setPortAutoIncrement(false); network.setPortAutoIncrement(false);
if (StringUtils.isNotBlank(hazelPublicAddress)) {
System.out.println("Hazelcast: Using public address " + hazelPublicAddress);
network.setPublicAddress(hazelPublicAddress);
}
if (StringUtils.isNotBlank(hazelInterfaces)) {
for (String hazelInterface : hazelInterfaces.split(",")) {
System.out.println("Hazelcast: Adding single interface " + hazelInterface);
network.getInterfaces().addInterface(hazelInterface);
}
}
JoinConfig join = network.getJoin(); JoinConfig join = network.getJoin();
join.getMulticastConfig().setEnabled(false); join.getMulticastConfig().setEnabled(false);
...@@ -80,15 +93,15 @@ public class HazelcastConfigAWS extends HazelcastConfig { ...@@ -80,15 +93,15 @@ public class HazelcastConfigAWS extends HazelcastConfig {
MapConfig defaultMapConfig = new MapConfig(); MapConfig defaultMapConfig = new MapConfig();
defaultMapConfig.setName("default"); defaultMapConfig.setName("default");
// defaultMapConfig.setTimeToLiveSeconds(0); // defaultMapConfig.setTimeToLiveSeconds(0);
defaultMapConfig.setEvictionPolicy(EvictionPolicy.LFU); defaultMapConfig.setEvictionPolicy(EvictionPolicy.LFU);
// defaultMapConfig.setMaxIdleSeconds(); // defaultMapConfig.setMaxIdleSeconds();
MaxSizeConfig defaultMaxSizeConfig = new MaxSizeConfig(); MaxSizeConfig defaultMaxSizeConfig = new MaxSizeConfig();
defaultMaxSizeConfig.setSize(defaultCacheSize); defaultMaxSizeConfig.setSize(defaultCacheSize);
defaultMaxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE); defaultMaxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
defaultMapConfig.setMaxSizeConfig(defaultMaxSizeConfig); defaultMapConfig.setMaxSizeConfig(defaultMaxSizeConfig);
cfg.addMapConfig(defaultMapConfig); cfg.addMapConfig(defaultMapConfig);
MapConfig tileserverMapConfig = new MapConfig(); MapConfig tileserverMapConfig = new MapConfig();
tileserverMapConfig.setName("tileserver"); tileserverMapConfig.setName("tileserver");
tileserverMapConfig.setTimeToLiveSeconds(tileserverTTL); tileserverMapConfig.setTimeToLiveSeconds(tileserverTTL);
......
...@@ -111,6 +111,9 @@ hazelcast.instanceName=hz-genesys-instance1 ...@@ -111,6 +111,9 @@ hazelcast.instanceName=hz-genesys-instance1
# Hazelcast cluster configuration # Hazelcast cluster configuration
hazelcast.name=hz-genesys-development hazelcast.name=hz-genesys-development
hazelcast.password=hazelcastdevelopment hazelcast.password=hazelcastdevelopment
# Binding and public address
hazelcast.publicAddress=
hazelcast.interfaces=
hazelcast.port=5701 hazelcast.port=5701
# AWS Autodetection # AWS Autodetection
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment