Fix hazelcast network config
@@ -94,18 +94,16 @@ public class DynamicCacheConfig implements ClusterConstants {
hazelcastConfig.addExecutorConfig(getExecutorConfig(AGENT_EXECUTOR_SERVICE_NAME));
hazelcastConfig.addTopicConfig(getTopicConfig());
NetworkConfig networkConfig = hazelcastConfig.getNetworkConfig();
- networkConfig.setPort(getClusterPort());
+ networkConfig.setPort(getClusterPort()).setPortAutoIncrement(false);
- if (isClustered() && getClusterURIs() != null && getClusterURIs().length > 0) {
JoinConfig join = networkConfig.getJoin();
join.getMulticastConfig().setEnabled(false);
+
+ if (isClustered() && getClusterURIs() != null && getClusterURIs().length > 0) {
TcpIpConfig tcpIpConfig = join.getTcpIpConfig();
tcpIpConfig.setEnabled(true);
tcpIpConfig.setMembers(Arrays.asList(getClusterURIs()));
networkConfig.setPublicAddress(selectLocalIp(Arrays.asList(getClusterURIs())));
- } else {
- JoinConfig join = networkConfig.getJoin();
- join.getMulticastConfig().setEnabled(false);
}
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(hazelcastConfig);
