com.hazelcast.nio.tcp

## Class MemberChannelInitializer

- java.lang.Object
- - com.hazelcast.nio.tcp.MemberChannelInitializer

- All Implemented Interfaces:
    com.hazelcast.internal.networking.ChannelInitializer

      public class MemberChannelInitializer
      extends Object
      implements com.hazelcast.internal.networking.ChannelInitializer

  The `ChannelInitializer` that runs on a member. It will identify the channel based on the protocol. If the channel is a 'client', it will automatically send the cluster protocol to the other side since both are members. This way the 'server' knows what it is dealing with. If the channel is a 'server', it needs to wait sending any information before the 'client' has send the protocol. If the 'client' is another member, it receives the cluster protocol. If the client is a true client, we don't send anything. If the channel is a 'server' and the client is ASCII client, it will not receive a specific ASCII protocol; if the first 3 bytes are not a known protocol, it will be interpreted as an ASCII (TextCommand) request.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MemberChannelInitializer(ILogger logger, IOService ioService)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.hazelcast.internal.networking.InitResult<com.hazelcast.internal.networking.ChannelInboundHandler>` | `initInbound(com.hazelcast.internal.networking.Channel channel)` Called when the Channel receives the first data.
    `com.hazelcast.internal.networking.InitResult<com.hazelcast.internal.networking.ChannelOutboundHandler>` | `initOutbound(com.hazelcast.internal.networking.Channel channel)` called when 'client' side member connects; will call with protocol "MEMBER' indirectly called 'server' side when the 'client' has told the protocol.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MemberChannelInitializer

          public MemberChannelInitializer(ILogger logger,
                                          IOService ioService)

  - ### Method Detail

    - #### initInbound

          public com.hazelcast.internal.networking.InitResult<com.hazelcast.internal.networking.ChannelInboundHandler> initInbound(com.hazelcast.internal.networking.Channel channel)
                                                                                                                            throws IOException

      Description copied from interface: `com.hazelcast.internal.networking.ChannelInitializer`
      Called when the Channel receives the first data. For the given channel, there will only be a single thread calling this method. But it could be that it is called concurrently for the same channel with `ChannelInitializer.initOutbound(Channel)`.
      Specified by:
        `initInbound` in interface `com.hazelcast.internal.networking.ChannelInitializer`
      Parameters:
        `channel` - the `Channel` that requires initialization
      Returns:
        the result of the initialization. Returned value could be null if not enough data is available to determine how to init (e.g. protocol info lacking). This will probably change once the TLS integration is done through the pipeline.
      Throws:
        `IOException`

    - #### initOutbound

          public com.hazelcast.internal.networking.InitResult<com.hazelcast.internal.networking.ChannelOutboundHandler> initOutbound(com.hazelcast.internal.networking.Channel channel)

      called when 'client' side member connects; will call with protocol "MEMBER' indirectly called 'server' side when the 'client' has told the protocol. In this case the protocol is e.g. CLIENT/MEMBER etc Idea: we need to have a way to send a 'task' to a channel e.g. setProtocol.
      Specified by:
        `initOutbound` in interface `com.hazelcast.internal.networking.ChannelInitializer`
      Parameters:
        `channel` - the `Channel` that requires initialization
      Returns:
        the result of the initialization.

Copyright © 2018. All rights reserved.