com.hazelcast.nio.tcp

## Class SingleProtocolDecoder

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

- Direct Known Subclasses:
    TextHandshakeDecoder

      public class SingleProtocolDecoder
      extends com.hazelcast.internal.networking.InboundHandler<ByteBuffer,Void>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.hazelcast.internal.networking.InboundHandler[]` | `inboundHandlers`
    `protected ProtocolType` | `supportedProtocol`

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

      `channel, dst, src`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SingleProtocolDecoder(ProtocolType supportedProtocol, com.hazelcast.internal.networking.InboundHandler next)`
    `SingleProtocolDecoder(ProtocolType supportedProtocol, com.hazelcast.internal.networking.InboundHandler[] next, MemberProtocolEncoder encoder)` Decodes first 3 incoming bytes, validates against `supportedProtocol` and, when matching, replaces itself in the inbound pipeline with the `next InboundHandler`s.

  - ### 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` | `onRead()` A callback to indicate that data is available in the src to be processed.
    `protected void` | `setupNextDecoder()`
    `protected void` | `verifyProtocol(String incomingProtocol)`

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

      `initSrcBuffer, initSrcBuffer`

    - ### 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`

- - ### Field Detail

    - #### inboundHandlers

          protected final com.hazelcast.internal.networking.InboundHandler[] inboundHandlers

    - #### supportedProtocol

          protected final ProtocolType supportedProtocol

  - ### Constructor Detail

    - #### SingleProtocolDecoder

          public SingleProtocolDecoder(ProtocolType supportedProtocol,
                                       com.hazelcast.internal.networking.InboundHandler next)

    - #### SingleProtocolDecoder

          public SingleProtocolDecoder(ProtocolType supportedProtocol,
                                       com.hazelcast.internal.networking.InboundHandler[] next,
                                       MemberProtocolEncoder encoder)

      Decodes first 3 incoming bytes, validates against `supportedProtocol` and, when matching, replaces itself in the inbound pipeline with the `next InboundHandler`s.
      Parameters:
        `supportedProtocol` - the `ProtocolType` supported by this `ProtocolDecoder`
        `next` - the `InboundHandler`s to replace this one in the inbound pipeline upon match of protocol bytes
        `encoder` - a `OutboundHandler` that will be notified when matching protocol bytes have been received

  - ### 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.InboundHandler,ByteBuffer,Void>`

    - #### onRead

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

      Description copied from class: `com.hazelcast.internal.networking.InboundHandler`
      A callback to indicate that data is available in the src to be processed. InboundHandlers should be able to deal with spurious onReads (so a read even though there is nothing to be processed).
      Specified by:
        `onRead` in class `com.hazelcast.internal.networking.InboundHandler<ByteBuffer,Void>`
      Returns:
        HandlerStatus the status of the handler after processing the src.

    - #### setupNextDecoder

          protected void setupNextDecoder()

    - #### verifyProtocol

          protected void verifyProtocol(String incomingProtocol)

Copyright © 2019. All rights reserved.