use of com.hazelcast.config.MemberAddressProviderConfig in project Payara by payara.
the class HazelcastCore method buildNetworkConfiguration.
private void buildNetworkConfiguration(Config config) throws NumberFormatException {
NetworkConfig nConfig = config.getNetworkConfig();
MemberAddressProviderConfig memberAddressProviderConfig = nConfig.getMemberAddressProviderConfig();
memberAddressProviderConfig.setEnabled(enabled);
memberAddressProviderConfig.setImplementation(new MemberAddressPicker(env, configuration, nodeConfig));
if (!configuration.getInterface().isEmpty()) {
// add an interfaces configuration
String[] interfaceNames = configuration.getInterface().split(",");
for (String interfaceName : interfaceNames) {
nConfig.getInterfaces().addInterface(interfaceName);
}
nConfig.getInterfaces().setEnabled(true);
}
String discoveryMode = configuration.getDiscoveryMode();
if (discoveryMode.startsWith("tcpip")) {
TcpIpConfig tConfig = config.getNetworkConfig().getJoin().getTcpIpConfig();
tConfig.setEnabled(true);
tConfig.addMember(configuration.getTcpipMembers());
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
} else if (discoveryMode.startsWith("multicast")) {
// build networking
MulticastConfig mcConfig = config.getNetworkConfig().getJoin().getMulticastConfig();
config.getNetworkConfig().setPortAutoIncrement(true);
mcConfig.setEnabled(true);
mcConfig.setMulticastGroup(configuration.getMulticastGroup());
mcConfig.setMulticastPort(Integer.valueOf(configuration.getMulticastPort()));
} else {
// build the domain discovery config
config.setProperty("hazelcast.discovery.enabled", "true");
config.getNetworkConfig().getJoin().getDiscoveryConfig().setDiscoveryServiceProvider(new DomainDiscoveryServiceProvider());
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
}
int port = Integer.valueOf(configuration.getStartPort());
if (env.isDas() && !env.isMicro()) {
port = Integer.valueOf(configuration.getDasPort());
}
config.getNetworkConfig().setPort(port);
}
Aggregations