@ChannelHandler.Sharable
public final class MemcachedCommandHandler
extends org.jboss.netty.channel.SimpleChannelUpstreamHandler
One instance is shared among the entire pipeline, since this handler is stateless, apart from some globals for the entire daemon.
The command handler produces ResponseMessages which are destined for the response encoder.
Modifier and Type | Field and Description |
---|---|
AtomicInteger |
curr_conns |
int |
idle_limit |
protected static org.apache.commons.logging.Log |
logger |
AtomicInteger |
total_conns |
boolean |
verbose |
String |
version
The following state variables are universal for the entire daemon.
|
Constructor and Description |
---|
MemcachedCommandHandler(SpaceCache cache,
String memcachedVersion,
boolean verbosity,
int idle,
org.jboss.netty.channel.group.DefaultChannelGroup channelGroup)
Construct the server session handler
|
Modifier and Type | Method and Description |
---|---|
void |
channelClosed(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
org.jboss.netty.channel.ChannelStateEvent channelStateEvent)
On close we manage some statistics, and remove this connection from the channel group.
|
void |
channelOpen(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
org.jboss.netty.channel.ChannelStateEvent channelStateEvent)
On open we manage some statistics, and add this connection to the channel group.
|
protected void |
handleAdd(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleAppend(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleCas(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleDecr(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleDelete(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleFlush(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleGets(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleIncr(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleNoOp(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command) |
protected void |
handlePrepend(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleQuit(org.jboss.netty.channel.Channel channel) |
protected void |
handleReplace(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleSet(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleStats(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
int cmdKeysSize,
org.jboss.netty.channel.Channel channel) |
protected void |
handleVerbosity(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
protected void |
handleVersion(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
CommandMessage command,
org.jboss.netty.channel.Channel channel) |
void |
messageReceived(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext,
org.jboss.netty.channel.MessageEvent messageEvent)
The actual meat of the matter.
|
protected static final org.apache.commons.logging.Log logger
public final AtomicInteger curr_conns
public final AtomicInteger total_conns
public final String version
public final int idle_limit
public final boolean verbose
public MemcachedCommandHandler(SpaceCache cache, String memcachedVersion, boolean verbosity, int idle, org.jboss.netty.channel.group.DefaultChannelGroup channelGroup)
cache
- the cache to usememcachedVersion
- the version string to return to clientsverbosity
- verbosity level for debuggingidle
- how long sessions can be idle forpublic void channelOpen(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, org.jboss.netty.channel.ChannelStateEvent channelStateEvent) throws Exception
channelOpen
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Exception
public void channelClosed(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, org.jboss.netty.channel.ChannelStateEvent channelStateEvent) throws Exception
channelClosed
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Exception
public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, org.jboss.netty.channel.MessageEvent messageEvent) throws Exception
messageReceived
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Exception
protected void handleNoOp(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command)
protected void handleFlush(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleVerbosity(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleQuit(org.jboss.netty.channel.Channel channel)
protected void handleVersion(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleStats(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, int cmdKeysSize, org.jboss.netty.channel.Channel channel)
protected void handleDelete(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleDecr(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleIncr(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handlePrepend(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleAppend(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleReplace(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleAdd(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleCas(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleSet(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
protected void handleGets(org.jboss.netty.channel.ChannelHandlerContext channelHandlerContext, CommandMessage command, org.jboss.netty.channel.Channel channel)
Copyright © GigaSpaces.