Search in sources :

Example 6 with InboundHandler

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);
}
Also used : SingleProtocolEncoder(com.hazelcast.internal.server.tcp.SingleProtocolEncoder) InboundHandler(com.hazelcast.internal.networking.InboundHandler) TcpServerConnection(com.hazelcast.internal.server.tcp.TcpServerConnection) ServerConnection(com.hazelcast.internal.server.ServerConnection) TcpServerConnection(com.hazelcast.internal.server.tcp.TcpServerConnection) TextHandshakeDecoder(com.hazelcast.internal.server.tcp.TextHandshakeDecoder)

Example 7 with InboundHandler

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);
}
Also used : OutboundHandler(com.hazelcast.internal.networking.OutboundHandler) InboundHandler(com.hazelcast.internal.networking.InboundHandler) ServerConnection(com.hazelcast.internal.server.ServerConnection)

Aggregations

InboundHandler (com.hazelcast.internal.networking.InboundHandler)7 ServerConnection (com.hazelcast.internal.server.ServerConnection)2 HandlerStatus (com.hazelcast.internal.networking.HandlerStatus)1 OutboundHandler (com.hazelcast.internal.networking.OutboundHandler)1 PacketDecoder (com.hazelcast.internal.server.tcp.PacketDecoder)1 SingleProtocolEncoder (com.hazelcast.internal.server.tcp.SingleProtocolEncoder)1 TcpServerConnection (com.hazelcast.internal.server.tcp.TcpServerConnection)1 TextHandshakeDecoder (com.hazelcast.internal.server.tcp.TextHandshakeDecoder)1 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)1 EOFException (java.io.EOFException)1 ByteBuffer (java.nio.ByteBuffer)1