public class QueryHandler extends AbstractGenericHandler<HttpObject,HttpRequest,QueryRequest>
The QueryHandler
is responsible for encoding QueryRequest
s into lower level HttpRequest
s as well as decoding HttpObject
s into CouchbaseResponse
s.
ChannelHandler.Sharable
CHARSET
Constructor and Description |
---|
QueryHandler(AbstractEndpoint endpoint,
com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer)
Creates a new
QueryHandler with the default queue for requests. |
Modifier and Type | Method and Description |
---|---|
protected CouchbaseResponse |
decodeResponse(ChannelHandlerContext ctx,
HttpObject msg)
Decodes the incoming response and transforms it into a
CouchbaseResponse . |
protected HttpRequest |
encodeRequest(ChannelHandlerContext ctx,
QueryRequest msg)
Encode the outgoing request and return it in encoded format.
|
void |
handlerRemoved(ChannelHandlerContext ctx) |
channelActive, channelInactive, channelWritabilityChanged, currentRequest, decode, encode, env, exceptionCaught, finishedDecoding, logIdent, publishResponse
acceptInboundMessage, acceptOutboundMessage, channelRead, write
bind, close, connect, deregister, disconnect, flush, read
channelReadComplete, channelRegistered, channelUnregistered, userEventTriggered
handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded
public QueryHandler(AbstractEndpoint endpoint, com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer)
Creates a new QueryHandler
with the default queue for requests.
endpoint
- the AbstractEndpoint
to coordinate with.responseBuffer
- the RingBuffer
to push responses into.protected HttpRequest encodeRequest(ChannelHandlerContext ctx, QueryRequest msg) throws Exception
AbstractGenericHandler
Encode the outgoing request and return it in encoded format.
This method needs to be implemented by the child handler and is responsible for the actual conversion.
encodeRequest
in class AbstractGenericHandler<HttpObject,HttpRequest,QueryRequest>
ctx
- the context passed in.msg
- the outgoing message.Exception
- as a generic error.protected CouchbaseResponse decodeResponse(ChannelHandlerContext ctx, HttpObject msg) throws Exception
AbstractGenericHandler
Decodes the incoming response and transforms it into a CouchbaseResponse
.
Note that the actual notification is handled by this generic handler, the implementing class only is concerned about the conversion itself.
decodeResponse
in class AbstractGenericHandler<HttpObject,HttpRequest,QueryRequest>
ctx
- the context passed in.msg
- the incoming message.Exception
- as a generic error.public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
handlerRemoved
in interface ChannelHandler
handlerRemoved
in class AbstractGenericHandler<HttpObject,HttpRequest,QueryRequest>
Exception
Copyright © 2014 Couchbase, Inc.