Class DcpControlHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<T>
com.couchbase.client.dcp.transport.netty.DcpControlHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public class DcpControlHandler
extends io.netty.channel.SimpleChannelInboundHandler<T>
Negotiates DCP control flags once connected and removes itself afterwards.
- Since:
- 1.0.0
- Author:
- Michael Nitschinger
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(io.netty.channel.ChannelHandlerContext ctx, SocketAddress localAddress, io.netty.channel.ChannelPromise promise) voidchannelActive(io.netty.channel.ChannelHandlerContext ctx) Once the channel becomes active, start negotiating the dcp control params.voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) protected voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf msg) Since only one feature per req/res can be negotiated, repeat the process once a response comes back until the iterator is complete or a non-success response status is received.voidclose(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) voidconnect(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise) Intercept the connect phase and store the original promise.voidderegister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) voiddisconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) voidflush(io.netty.channel.ChannelHandlerContext ctx) voidread(io.netty.channel.ChannelHandlerContext ctx) voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) voidwrite(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChangedMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Method Details
-
channelActive
Once the channel becomes active, start negotiating the dcp control params.- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelRead0
protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf msg) throws Exception Since only one feature per req/res can be negotiated, repeat the process once a response comes back until the iterator is complete or a non-success response status is received.- Specified by:
channelRead0in classio.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:
connectin interfaceio.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:
bindin interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
disconnect
public void disconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception - Specified by:
disconnectin interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
close
public void close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception - Specified by:
closein interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
deregister
public void deregister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception - Specified by:
deregisterin interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
read
- Specified by:
readin interfaceio.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:
writein interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
flush
- Specified by:
flushin interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception - Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelInactive
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-