com.hazelcast.nio.tcp

## Class UnifiedProtocolEncoder

- java.lang.Object
- - com.hazelcast.internal.networking.ChannelHandler<com.hazelcast.internal.networking.OutboundHandler,S,D>
  - - com.hazelcast.internal.networking.OutboundHandler<Void,ByteBuffer>
    - - com.hazelcast.nio.tcp.UnifiedProtocolEncoder

-     public class UnifiedProtocolEncoder
      extends com.hazelcast.internal.networking.OutboundHandler<Void,ByteBuffer>

  The ProtocolEncoder is responsible for writing the protocol and once the protocol has been written, the ProtocolEncoder is replaced by the appropriate handler. The ProtocolEncoder and the 'client' side of a member connection, will always write the cluster protocol immediately. The ProtocolEncoder on the 'server' side of the connection will wait till it has received the protocol and then will only send the protocol if the client side was a member.

- - ### Field Summary

    - ### Fields inherited from class com.hazelcast.internal.networking.ChannelHandler

      `channel, dst, src`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnifiedProtocolEncoder(IOService ioService)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `handlerAdded()` Gets called when this ChannelHandler is added to the pipeline.
    `com.hazelcast.internal.networking.HandlerStatus` | `onWrite()` A callback to indicate that this OutboundHandler should be processed.

    - ### Methods inherited from class com.hazelcast.internal.networking.OutboundHandler

      `initDstBuffer, initDstBuffer, initDstBuffer`

    - ### Methods inherited from class com.hazelcast.internal.networking.ChannelHandler

      `dst, dst, interceptError, setChannel, src, src`

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

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

- - ### Constructor Detail

    - #### UnifiedProtocolEncoder

          public UnifiedProtocolEncoder(IOService ioService)

  - ### Method Detail

    - #### handlerAdded

          public void handlerAdded()

      Description copied from class: `com.hazelcast.internal.networking.ChannelHandler`
      Gets called when this ChannelHandler is added to the pipeline. This method should execute very quickly because it could be executed on an io thread. Will be called from a thread owning this handler.
      Overrides:
        `handlerAdded` in class `com.hazelcast.internal.networking.ChannelHandler<com.hazelcast.internal.networking.OutboundHandler,Void,ByteBuffer>`

    - #### onWrite

          public com.hazelcast.internal.networking.HandlerStatus onWrite()

      Description copied from class: `com.hazelcast.internal.networking.OutboundHandler`
      A callback to indicate that this OutboundHandler should be processed. A OutboundHandler should be able to deal with a spurious wakeup. So it could be for example there is no frame for it to write to.
      Specified by:
        `onWrite` in class `com.hazelcast.internal.networking.OutboundHandler<Void,ByteBuffer>`
      Returns:
        `HandlerStatus` the status of the handler after processing the src.

Copyright © 2020. All rights reserved.