use of com.hazelcast.config.EndpointConfig in project hazelcast by hazelcast.
the class DefaultAddressPicker method getPublicAddressByPortSearch.
private AddressDefinition getPublicAddressByPortSearch() throws IOException {
boolean bindAny = hazelcastProperties.getBoolean(ClusterProperty.SOCKET_SERVER_BIND_ANY);
AddressDefinition bindAddressDef = pickAddressDef();
EndpointConfig endpoint = config.getAdvancedNetworkConfig().isEnabled() ? config.getAdvancedNetworkConfig().getEndpointConfigs().get(endpointQualifier) : null;
serverSocketChannel = createServerSocketChannel(logger, endpoint, bindAddressDef.inetAddress, bindAddressDef.port == 0 ? port : bindAddressDef.port, portCount, isPortAutoIncrement, isReuseAddress, bindAny);
int port = serverSocketChannel.socket().getLocalPort();
bindAddress = createAddress(bindAddressDef, port);
if (logger.isFineEnabled()) {
logger.fine("Picked " + bindAddress + (endpointQualifier == null ? "" : ", for endpoint " + endpointQualifier) + ", using socket " + serverSocketChannel.socket() + ", bind any local is " + bindAny);
}
return getPublicAddress(port);
}
use of com.hazelcast.config.EndpointConfig in project hazelcast by hazelcast.
the class DelegatingAddressPicker method pickAddressFromEndpointConfig.
private void pickAddressFromEndpointConfig() {
InetSocketAddress bindAddress;
InetSocketAddress publicAddress;
ServerSocketChannel serverSocketChannel;
for (EndpointConfig config : config.getAdvancedNetworkConfig().getEndpointConfigs().values()) {
if (!(config instanceof ServerSocketEndpointConfig)) {
continue;
}
ServerSocketEndpointConfig endpointConfig = (ServerSocketEndpointConfig) config;
EndpointQualifier qualifier = endpointConfig.getQualifier();
bindAddress = memberAddressProvider.getBindAddress(qualifier);
publicAddress = memberAddressProvider.getPublicAddress(qualifier);
validatePublicAddress(publicAddress);
if (!bindAddresses.values().contains(bindAddress)) {
// bind new server socket
serverSocketChannel = createServerSocketChannel(logger, config, bindAddress.getAddress(), bindAddress.getPort() == 0 ? endpointConfig.getPort() : bindAddress.getPort(), endpointConfig.getPortCount(), endpointConfig.isPortAutoIncrement(), endpointConfig.isReuseAddress(), false);
serverSocketChannels.put(qualifier, serverSocketChannel);
int port = serverSocketChannel.socket().getLocalPort();
if (port != bindAddress.getPort()) {
bindAddress = new InetSocketAddress(bindAddress.getAddress(), port);
}
if (publicAddress.getPort() == 0) {
publicAddress = new InetSocketAddress(publicAddress.getAddress(), port);
}
}
logger.info("Using bind address: " + bindAddress + ", " + "public address: " + publicAddress + " for qualifier " + qualifier);
bindAddresses.put(qualifier, bindAddress);
publicAddresses.put(qualifier, publicAddress);
}
}
use of com.hazelcast.config.EndpointConfig in project hazelcast by hazelcast.
the class MemberDomConfigProcessor method handleWanEndpointConfig.
protected void handleWanEndpointConfig(Node node) throws Exception {
EndpointConfig config = new EndpointConfig();
config.setProtocolType(ProtocolType.WAN);
handleEndpointConfig(config, node);
}
use of com.hazelcast.config.EndpointConfig in project hazelcast by hazelcast.
the class ConfigValidator method warnForUsageOfDeprecatedSymmetricEncryption.
public static void warnForUsageOfDeprecatedSymmetricEncryption(Config config, ILogger logger) {
String warn = "Symmetric encryption is deprecated and will be removed in a future version. Consider using TLS instead.";
boolean usesAdvancedNetworkConfig = config.getAdvancedNetworkConfig().isEnabled();
if (config.getNetworkConfig() != null && config.getNetworkConfig().getSymmetricEncryptionConfig() != null && config.getNetworkConfig().getSymmetricEncryptionConfig().isEnabled() && !usesAdvancedNetworkConfig) {
logger.warning(warn);
}
if (config.getAdvancedNetworkConfig() != null && config.getAdvancedNetworkConfig().getEndpointConfigs() != null && usesAdvancedNetworkConfig) {
for (EndpointConfig endpointConfig : config.getAdvancedNetworkConfig().getEndpointConfigs().values()) {
if (endpointConfig.getSymmetricEncryptionConfig() != null && endpointConfig.getSymmetricEncryptionConfig().isEnabled()) {
logger.warning(warn);
// Write error message once if more than one endpoint use symmetric encryption
break;
}
}
}
}
use of com.hazelcast.config.EndpointConfig in project hazelcast by hazelcast.
the class YamlMemberDomConfigProcessor method handleWanEndpointConfig.
@Override
protected void handleWanEndpointConfig(Node node) throws Exception {
for (Node wanEndpointNode : childElements(node)) {
EndpointConfig config = new EndpointConfig();
config.setProtocolType(ProtocolType.WAN);
String endpointName = wanEndpointNode.getNodeName().trim();
handleEndpointConfig(config, wanEndpointNode, endpointName);
}
}
Aggregations