Class DcpConnectHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<T>
com.couchbase.client.dcp.transport.netty.DcpConnectHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler

public class DcpConnectHandler extends io.netty.channel.SimpleChannelInboundHandler<T>
Opens the DCP connection on the channel and once established removes itself.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bind(io.netty.channel.ChannelHandlerContext ctx, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)
     
    void
    channelActive(io.netty.channel.ChannelHandlerContext ctx)
    Assigns a name to the connection and starts the first connection step.
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
     
    protected void
    channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf msg)
    Once we get a response from the connect request, check if it is successful and complete/fail the connect phase accordingly.
    void
    close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
     
    void
    connect(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)
    Intercept the connect phase and store the original promise.
    void
    deregister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
     
    void
    disconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
     
    void
    exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
     
    void
    flush(io.netty.channel.ChannelHandlerContext ctx)
     
    getFeatures(io.netty.channel.Channel channel)
    Returns the features from the HELO response (the intersection of the features we advertised and the features supported by the server).
    static Version
    getServerVersion(io.netty.channel.Channel channel)
    Returns the Couchbase Server version associated with the given channel.
    void
    read(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt)
     
    void
    write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)
     

    Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

    acceptInboundMessage, channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Method Details

    • getServerVersion

      public static Version getServerVersion(io.netty.channel.Channel channel)
      Returns the Couchbase Server version associated with the given channel.
      Throws:
      IllegalStateException - if DcpConnectHandler has not yet issued a Version request and processed the result.
    • getFeatures

      public static Set<HelloFeature> getFeatures(io.netty.channel.Channel channel)
      Returns the features from the HELO response (the intersection of the features we advertised and the features supported by the server).
      Throws:
      IllegalStateException - if DcpConnectHandler has not yet issued a HELO request and processed the result.
    • channelActive

      public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Assigns a name to the connection and starts the first connection step.
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelRead0

      protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf msg) throws Exception
      Once we get a response from the connect request, check if it is successful and complete/fail the connect phase accordingly.
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.buffer.ByteBuf>
      Throws:
      Exception
    • connect

      public void connect(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise) throws Exception
      Intercept the connect phase and store the original promise.
      Specified by:
      connect in interface io.netty.channel.ChannelOutboundHandler
      Throws:
      Exception
    • bind

      public void bind(io.netty.channel.ChannelHandlerContext ctx, SocketAddress localAddress, io.netty.channel.ChannelPromise promise) throws Exception
      Specified by:
      bind in interface io.netty.channel.ChannelOutboundHandler
      Throws:
      Exception
    • disconnect

      public void disconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception
      Specified by:
      disconnect in interface io.netty.channel.ChannelOutboundHandler
      Throws:
      Exception
    • close

      public void close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception
      Specified by:
      close in interface io.netty.channel.ChannelOutboundHandler
      Throws:
      Exception
    • deregister

      public void deregister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception
      Specified by:
      deregister in interface io.netty.channel.ChannelOutboundHandler
      Throws:
      Exception
    • read

      public void read(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      read in interface io.netty.channel.ChannelOutboundHandler
      Throws:
      Exception
    • write

      public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) throws Exception
      Specified by:
      write in interface io.netty.channel.ChannelOutboundHandler
      Throws:
      Exception
    • flush

      public void flush(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      flush in interface io.netty.channel.ChannelOutboundHandler
      Throws:
      Exception
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • userEventTriggered

      public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception
      Specified by:
      userEventTriggered in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      userEventTriggered in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception