use of com.hazelcast.internal.networking.InboundHandler in project hazelcast by hazelcast.
the class TextChannelInitializer method initChannel.
@Override
public void initChannel(Channel channel) {
ServerConnection connection = (TcpServerConnection) channel.attributeMap().get(ServerConnection.class);
SingleProtocolEncoder encoder = new SingleProtocolEncoder(new TextEncoder(connection));
InboundHandler decoder = rest ? new RestApiTextDecoder(connection, (TextEncoder) encoder.getFirstOutboundHandler(), true) : new MemcacheTextDecoder(connection, (TextEncoder) encoder.getFirstOutboundHandler(), true);
TextHandshakeDecoder handshaker = new TextHandshakeDecoder(rest ? ProtocolType.REST : ProtocolType.MEMCACHE, decoder, encoder);
channel.outboundPipeline().addLast(encoder);
channel.inboundPipeline().addLast(handshaker);
}
use of com.hazelcast.internal.networking.InboundHandler in project hazelcast by hazelcast.
the class MemberChannelInitializer method initChannel.
@Override
public void initChannel(Channel channel) {
ServerConnection connection = (TcpServerConnection) channel.attributeMap().get(ServerConnection.class);
OutboundHandler[] outboundHandlers = serverContext.createOutboundHandlers(EndpointQualifier.MEMBER, connection);
InboundHandler[] inboundHandlers = serverContext.createInboundHandlers(EndpointQualifier.MEMBER, connection);
SingleProtocolEncoder protocolEncoder = new SingleProtocolEncoder(new MemberProtocolEncoder(outboundHandlers));
SingleProtocolDecoder protocolDecoder = new SingleProtocolDecoder(ProtocolType.MEMBER, inboundHandlers, protocolEncoder, true);
channel.outboundPipeline().addLast(protocolEncoder);
channel.inboundPipeline().addLast(protocolDecoder);
}
Aggregations