
Classes | |
| class | SessionStatus |
Public Member Functions | |
| final MessageDecoderResult | decodable (IoSession session, ByteBuffer in) |
| final MessageDecoderResult | decode (IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception |
| final int | Now () |
Static Public Attributes | |
| static CharsetDecoder | DECODER = Charset.forName("US-ASCII").newDecoder() |
Package Types | |
| enum | SessionState { ERROR, WAITING_FOR_DATA, READY } |
Private Member Functions | |
| SessionStatus | continueSet (IoSession session, ProtocolDecoderOutput out, SessionStatus state, byte[] remainder) |
| SessionStatus | processLine (List< String > parts, IoSession session, ProtocolDecoderOutput out) |
Static Private Attributes | |
| static final String | SESSION_STATUS = "sessionStatus" |
| static final int | THIRTY_DAYS = 60 * 60 * 24 * 30 |
| static final int | WORD_BUFFER_INIT_SIZE = 16 |
enum SessionState [package] |
| SessionStatus continueSet | ( | IoSession | session, | |
| ProtocolDecoderOutput | out, | |||
| SessionStatus | state, | |||
| byte[] | remainder | |||
| ) | [private] |
Handles the continuation of a SET/ADD/REPLACE command with the data it was waiting for.
| session | the MINA IoSession | |
| out | the MINA protocol decoder output which we signal with the completed command | |
| state | the current session status (unused) | |
| remainder | the bytes picked up |
| final MessageDecoderResult decodable | ( | IoSession | session, | |
| ByteBuffer | in | |||
| ) |
Checks the specified buffer is decodable by this decoder.
In our case checks the session state to see if we are waiting for data. If we are, make sure that we actually have all the data we need.
| final MessageDecoderResult decode | ( | IoSession | session, | |
| ByteBuffer | in, | |||
| ProtocolDecoderOutput | out | |||
| ) | throws Exception |
Actually decodes inbound data from the memcached protocol session.
MINA invokes decode(IoSession, ByteBuffer, ProtocolDecoderOutput) method with read data, and then the decoder implementation puts decoded messages into ProtocolDecoderOutput.
| Exception | if the read data violated protocol specification |
| final int Now | ( | ) |
| SessionStatus processLine | ( | List< String > | parts, | |
| IoSession | session, | |||
| ProtocolDecoderOutput | out | |||
| ) | [private] |
Process an individual completel protocol line and either passes the command for processing by the session handler, or (in the case of SET-type commands) partially parses the command and sets the session into a state to wait for additional data.
| parts | the (originally space separated) parts of the command | |
| session | the MINA IoSession | |
| out | the MINA protocol decoder output to pass our command on to |
CharsetDecoder DECODER = Charset.forName("US-ASCII").newDecoder() [static] |
final String SESSION_STATUS = "sessionStatus" [static, private] |
final int THIRTY_DAYS = 60 * 60 * 24 * 30 [static, private] |
final int WORD_BUFFER_INIT_SIZE = 16 [static, private] |
1.5.8