Class KeyValueFeatureHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<FullBinaryMemcacheResponse>
com.couchbase.client.core.endpoint.kv.KeyValueFeatureHandler
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
,ChannelOutboundHandler
public class KeyValueFeatureHandler extends SimpleChannelInboundHandler<FullBinaryMemcacheResponse> implements ChannelOutboundHandler
This handler negotiates the enabled features through the HELLO command.
Like the SASL auth handler, this handler intercepts the original connect process to properly negotiate the
supported features with the server. Once the features are negotiated they are sent through custom events up the
pipeline and the handler removes itself.
- Since:
- 1.2.0
- Author:
- Michael Nitschinger
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Constructor Summary
Constructors Constructor Description KeyValueFeatureHandler(CoreContext ctx)
-
Method Summary
Modifier and Type Method Description void
bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise)
void
channelActive(ChannelHandlerContext ctx)
protected void
channelRead0(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg)
void
close(ChannelHandlerContext ctx, ChannelPromise promise)
void
connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise)
void
deregister(ChannelHandlerContext ctx, ChannelPromise promise)
void
disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
void
flush(ChannelHandlerContext ctx)
static String
paddedHex(long number)
Helper method to create a padded hex long value.void
read(ChannelHandlerContext ctx)
void
write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
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
-
Constructor Details
-
KeyValueFeatureHandler
-
-
Method Details
-
channelRead0
protected void channelRead0(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception- Specified by:
channelRead0
in classSimpleChannelInboundHandler<FullBinaryMemcacheResponse>
- Throws:
Exception
-
channelActive
- Specified by:
channelActive
in interfaceChannelInboundHandler
- Overrides:
channelActive
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
paddedHex
Helper method to create a padded hex long value.- Parameters:
number
- number to pad.- Returns:
- the padded hex number.
-
connect
public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception- Specified by:
connect
in interfaceChannelOutboundHandler
- Throws:
Exception
-
disconnect
- Specified by:
disconnect
in interfaceChannelOutboundHandler
- Throws:
Exception
-
close
- Specified by:
close
in interfaceChannelOutboundHandler
- Throws:
Exception
-
deregister
- Specified by:
deregister
in interfaceChannelOutboundHandler
- Throws:
Exception
-
read
- Specified by:
read
in interfaceChannelOutboundHandler
- Throws:
Exception
-
write
- Specified by:
write
in interfaceChannelOutboundHandler
- Throws:
Exception
-
flush
- Specified by:
flush
in interfaceChannelOutboundHandler
- Throws:
Exception
-
bind
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception- Specified by:
bind
in interfaceChannelOutboundHandler
- Throws:
Exception
-