public abstract class AbstractProtocolDecoder<K,V> extends org.jboss.netty.handler.codec.replay.ReplayingDecoder<DecoderState> implements ServerConstants, Log
Constructor and Description |
---|
AbstractProtocolDecoder(NettyTransport transport) |
Modifier and Type | Method and Description |
---|---|
protected Metadata |
buildMetadata() |
protected AdvancedCache<K,V> |
cache() |
void |
channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e) |
Object |
checkpointTo(DecoderState state) |
protected abstract Object |
createErrorResponse(Throwable t) |
protected abstract Object |
createGetResponse(K k,
CacheEntry entry) |
protected abstract RequestHeader |
createHeader() |
protected abstract Object |
createMultiGetResponse(scala.collection.immutable.Map<K,CacheEntry> pairs) |
protected abstract Object |
createNotExecutedResponse(V prev) |
protected abstract Object |
createNotExistResponse() |
protected abstract scala.Tuple2<Exception,Object> |
createServerException(Exception e,
org.jboss.netty.buffer.ChannelBuffer b) |
protected abstract Object |
createStatsResponse() |
protected abstract Object |
createSuccessResponse(V prev) |
protected abstract V |
createValue() |
protected abstract Object |
customDecodeHeader(org.jboss.netty.channel.Channel ch,
org.jboss.netty.buffer.ChannelBuffer buffer) |
protected abstract Object |
customDecodeKey(org.jboss.netty.channel.Channel ch,
org.jboss.netty.buffer.ChannelBuffer buffer) |
protected abstract Object |
customDecodeValue(org.jboss.netty.channel.Channel ch,
org.jboss.netty.buffer.ChannelBuffer buffer) |
Object |
decode(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.Channel ch,
org.jboss.netty.buffer.ChannelBuffer buffer,
DecoderState state) |
Object |
decodeLast(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.Channel ch,
org.jboss.netty.buffer.ChannelBuffer buffer,
DecoderState state) |
protected long |
defaultLifespanTime() |
protected long |
defaultMaxIdleTime() |
void |
exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ExceptionEvent e) |
protected EntryVersion |
generateVersion(Cache<K,V> cache) |
protected Object |
get(org.jboss.netty.buffer.ChannelBuffer buffer) |
protected abstract Cache<K,V> |
getCache() |
protected AdvancedCache<K,V> |
getOptimizedCache(AdvancedCache<K,V> c) |
Object |
handleModification(org.jboss.netty.channel.Channel ch,
org.jboss.netty.buffer.ChannelBuffer buf) |
protected RequestHeader |
header() |
protected K |
key() |
void |
messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent e) |
protected RequestParameters |
params() |
protected byte[] |
rawValue() |
protected abstract scala.Option<Object> |
readHeader(org.jboss.netty.buffer.ChannelBuffer b,
RequestHeader header) |
protected abstract scala.Tuple2<K,Object> |
readKey(org.jboss.netty.buffer.ChannelBuffer b)
Returns the key read along with a boolean indicating whether the
end of the operation was found or not.
|
protected abstract boolean |
readParameters(org.jboss.netty.channel.Channel ch,
org.jboss.netty.buffer.ChannelBuffer b) |
protected abstract void |
readValue(org.jboss.netty.buffer.ChannelBuffer b) |
protected long |
toMillis(int lifespan)
Transforms lifespan pass as seconds into milliseconds
following this rule:
|
void |
writeComplete(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.WriteCompletionEvent e) |
protected Object |
writeResponse(org.jboss.netty.channel.Channel ch,
Object response) |
checkpoint, checkpoint, cleanup, decode, decodeLast, getState, internalBuffer, setState
actualReadableBytes, afterAdd, afterRemove, appendToCumulation, beforeAdd, beforeRemove, channelClosed, channelDisconnected, extractFrame, getMaxCumulationBufferCapacity, getMaxCumulationBufferComponents, isUnfold, newCumulationBuffer, replace, setMaxCumulationBufferCapacity, setMaxCumulationBufferComponents, setUnfold, unfoldAndFireMessageReceived, updateCumulation
channelBound, channelConnected, channelInterestChanged, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
EXPIRATION_DEFAULT, EXPIRATION_NONE
debug, debug, debug, debug, debug, debugf, error, info, info, isDebugEnabled, isTraceEnabled, log, logChannelStillBound, logChannelStillConnected, logErrorBeforeReadingRequest, logExceptionReported, logPostingShutdownRequest, logServerDidNotClose, logServerDidNotUnbind, logSettingMasterThreadsNotSupported, logStartWithArgs, trace, trace, trace, trace, tracef, warn
public AbstractProtocolDecoder(NettyTransport transport)
protected RequestHeader header()
protected RequestParameters params()
protected K key()
protected byte[] rawValue()
protected AdvancedCache<K,V> cache()
protected long defaultLifespanTime()
protected long defaultMaxIdleTime()
public Object decode(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.Channel ch, org.jboss.netty.buffer.ChannelBuffer buffer, DecoderState state)
decode
in class org.jboss.netty.handler.codec.replay.ReplayingDecoder<DecoderState>
public Object handleModification(org.jboss.netty.channel.Channel ch, org.jboss.netty.buffer.ChannelBuffer buf)
public Object decodeLast(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.Channel ch, org.jboss.netty.buffer.ChannelBuffer buffer, DecoderState state)
decodeLast
in class org.jboss.netty.handler.codec.replay.ReplayingDecoder<DecoderState>
protected Metadata buildMetadata()
protected AdvancedCache<K,V> getOptimizedCache(AdvancedCache<K,V> c)
protected Object get(org.jboss.netty.buffer.ChannelBuffer buffer)
public void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ExceptionEvent e)
exceptionCaught
in class org.jboss.netty.handler.codec.frame.FrameDecoder
public void channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ChannelStateEvent e)
channelOpen
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
public Object checkpointTo(DecoderState state)
protected abstract RequestHeader createHeader()
protected abstract scala.Option<Object> readHeader(org.jboss.netty.buffer.ChannelBuffer b, RequestHeader header)
protected abstract scala.Tuple2<K,Object> readKey(org.jboss.netty.buffer.ChannelBuffer b)
protected abstract boolean readParameters(org.jboss.netty.channel.Channel ch, org.jboss.netty.buffer.ChannelBuffer b)
protected abstract void readValue(org.jboss.netty.buffer.ChannelBuffer b)
protected abstract V createValue()
protected abstract Object createNotExistResponse()
protected abstract Object createGetResponse(K k, CacheEntry entry)
protected abstract Object createMultiGetResponse(scala.collection.immutable.Map<K,CacheEntry> pairs)
protected abstract Object createStatsResponse()
protected abstract Object customDecodeHeader(org.jboss.netty.channel.Channel ch, org.jboss.netty.buffer.ChannelBuffer buffer)
protected abstract Object customDecodeKey(org.jboss.netty.channel.Channel ch, org.jboss.netty.buffer.ChannelBuffer buffer)
protected abstract Object customDecodeValue(org.jboss.netty.channel.Channel ch, org.jboss.netty.buffer.ChannelBuffer buffer)
protected abstract scala.Tuple2<Exception,Object> createServerException(Exception e, org.jboss.netty.buffer.ChannelBuffer b)
protected EntryVersion generateVersion(Cache<K,V> cache)
protected long toMillis(int lifespan)
If lifespan is bigger than number of seconds in 30 days, then it is considered unix time. After converting it to milliseconds, we substract the current time in and the result is returned.
Otherwise it's just considered number of seconds from now and it's returned in milliseconds unit.
public void writeComplete(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.WriteCompletionEvent e)
writeComplete
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.MessageEvent e)
messageReceived
in class org.jboss.netty.handler.codec.replay.ReplayingDecoder<DecoderState>
Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.