use of com.hazelcast.internal.networking.ChannelInitializer in project hazelcast by hazelcast.
the class ChannelInitializerFunction method init.
public void init() {
AdvancedNetworkConfig advancedNetworkConfig = config.getAdvancedNetworkConfig();
if (!advancedNetworkConfig.isEnabled() || advancedNetworkConfig.getEndpointConfigs().isEmpty()) {
initializerMap = Collections.emptyMap();
return;
}
Map<EndpointQualifier, ChannelInitializer> map = new HashMap<EndpointQualifier, ChannelInitializer>();
for (EndpointConfig endpointConfig : advancedNetworkConfig.getEndpointConfigs().values()) {
checkSslConfigAvailability(endpointConfig.getSSLConfig());
switch(endpointConfig.getProtocolType()) {
case MEMBER:
map.put(EndpointQualifier.MEMBER, provideMemberChannelInitializer(endpointConfig));
break;
case CLIENT:
map.put(EndpointQualifier.CLIENT, provideClientChannelInitializer(endpointConfig));
break;
case REST:
map.put(EndpointQualifier.REST, provideTextChannelInitializer(endpointConfig, true));
break;
case MEMCACHE:
map.put(EndpointQualifier.MEMCACHE, provideTextChannelInitializer(endpointConfig, false));
break;
case WAN:
map.put(endpointConfig.getQualifier(), provideMemberChannelInitializer(endpointConfig));
break;
default:
throw new IllegalStateException("Cannot build channel initializer for protocol type " + endpointConfig.getProtocolType());
}
}
initializerMap = map;
}
use of com.hazelcast.internal.networking.ChannelInitializer in project hazelcast by hazelcast.
the class TcpServerConnectionManager method newChannel.
Channel newChannel(SocketChannel socketChannel, boolean clientMode) throws IOException {
Networking networking = server.getNetworking();
ChannelInitializer channelInitializer = channelInitializerFn.apply(endpointQualifier);
assert channelInitializer != null : "Found NULL channel initializer for endpoint-qualifier " + endpointQualifier;
Channel channel = networking.register(channelInitializer, socketChannel, clientMode);
// Advanced Network
if (endpointConfig != null) {
setChannelOptions(channel, endpointConfig);
}
acceptedChannels.add(channel);
return channel;
}
Aggregations