public class DCPHandler extends AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,DCPRequest>
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
static byte |
OP_BUFFER_ACK |
static byte |
OP_CONTROL |
static byte |
OP_EXPIRATION |
static byte |
OP_GET_FAILOVER_LOG |
static byte |
OP_GET_LAST_CHECKPOINT |
static byte |
OP_MUTATION |
static byte |
OP_OPEN_CONNECTION |
static byte |
OP_REMOVE |
static byte |
OP_SNAPSHOT_MARKER |
static byte |
OP_STREAM_CLOSE |
static byte |
OP_STREAM_END |
static byte |
OP_STREAM_REQUEST |
CHARSET, EMPTY_BYTES
Constructor and Description |
---|
DCPHandler(AbstractEndpoint endpoint,
com.lmax.disruptor.EventSink<ResponseEvent> responseBuffer,
boolean isTransient)
Creates a new
DCPHandler with the default queue for requests. |
DCPHandler(AbstractEndpoint endpoint,
com.lmax.disruptor.EventSink<ResponseEvent> responseBuffer,
Queue<DCPRequest> queue,
boolean isTransient)
Creates a new
DCPHandler with a custom queue for requests (suitable for tests). |
Modifier and Type | Method and Description |
---|---|
protected CouchbaseResponse |
decodeResponse(ChannelHandlerContext ctx,
FullBinaryMemcacheResponse msg)
Decodes the incoming response and transforms it into a
CouchbaseResponse . |
protected BinaryMemcacheRequest |
encodeRequest(ChannelHandlerContext ctx,
DCPRequest msg)
Encode the outgoing request and return it in encoded format.
|
void |
handlerRemoved(ChannelHandlerContext ctx) |
protected ServiceType |
serviceType()
Returns the
ServiceType associated with this handler. |
addHttpBasicAuth, channelActive, channelInactive, channelWritabilityChanged, connect, createKeepAliveRequest, currentRequest, currentRequest, decode, encode, endpoint, env, exceptionCaught, finishedDecoding, logIdent, onKeepAliveFired, onKeepAliveResponse, publishResponse, remoteHostname, remoteHttpHost, sideEffectRequestToCancel, userEventTriggered
acceptInboundMessage, acceptOutboundMessage, channelRead, write
bind, close, deregister, disconnect, flush, read
channelReadComplete, channelRegistered, channelUnregistered
handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded
public static final byte OP_OPEN_CONNECTION
public static final byte OP_STREAM_CLOSE
public static final byte OP_STREAM_REQUEST
public static final byte OP_STREAM_END
public static final byte OP_SNAPSHOT_MARKER
public static final byte OP_MUTATION
public static final byte OP_REMOVE
public static final byte OP_EXPIRATION
public static final byte OP_CONTROL
public static final byte OP_BUFFER_ACK
public static final byte OP_GET_FAILOVER_LOG
public static final byte OP_GET_LAST_CHECKPOINT
public DCPHandler(AbstractEndpoint endpoint, com.lmax.disruptor.EventSink<ResponseEvent> responseBuffer, boolean isTransient)
Creates a new DCPHandler
with the default queue for requests.
endpoint
- the AbstractEndpoint
to coordinate with.responseBuffer
- the EventSink
to push responses into.public DCPHandler(AbstractEndpoint endpoint, com.lmax.disruptor.EventSink<ResponseEvent> responseBuffer, Queue<DCPRequest> queue, boolean isTransient)
Creates a new DCPHandler
with a custom queue for requests (suitable for tests).
endpoint
- the AbstractEndpoint
to coordinate with.responseBuffer
- the EventSink
to push responses into.queue
- the queue which holds all outstanding open requests.protected BinaryMemcacheRequest encodeRequest(ChannelHandlerContext ctx, DCPRequest 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<FullBinaryMemcacheResponse,BinaryMemcacheRequest,DCPRequest>
ctx
- the context passed in.msg
- the outgoing message.Exception
- as a generic error.protected CouchbaseResponse decodeResponse(ChannelHandlerContext ctx, FullBinaryMemcacheResponse 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<FullBinaryMemcacheResponse,BinaryMemcacheRequest,DCPRequest>
ctx
- the context passed in.msg
- the incoming message.Exception
- as a generic error. It will be bubbled up to the user (wrapped in a CouchbaseException) in the onError of the request’s Observable.public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
handlerRemoved
in interface ChannelHandler
handlerRemoved
in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,DCPRequest>
Exception
protected ServiceType serviceType()
AbstractGenericHandler
Returns the ServiceType
associated with this handler.
serviceType
in class AbstractGenericHandler<FullBinaryMemcacheResponse,BinaryMemcacheRequest,DCPRequest>
Copyright © 2016 Couchbase, Inc.. All rights reserved.