Package com.thimbleware.jmemcached.protocol

Examples of com.thimbleware.jmemcached.protocol.Command


  @Override
  public void messageReceived(ChannelHandlerContext channelHandlerContext, MessageEvent messageEvent)
      throws Exception {
    ResponseMessage<CACHE_ELEMENT> command = (ResponseMessage<CACHE_ELEMENT>) messageEvent.getMessage();

    Command cmd = command.cmd.cmd;

    Channel channel = messageEvent.getChannel();

    if (cmd == Command.GET || cmd == Command.GETS) {
      CacheElement[] results = command.elements;
View Full Code Here


  private void processLine(List<String> parts, Channel channel, ChannelHandlerContext channelHandlerContext)
      throws UnknownCommandException, MalformedCommandException {
    final int numParts = parts.size();

    // Turn the command into an enum for matching on
    Command cmdType;
    try {
      cmdType = Command.valueOf(parts.get(0).toUpperCase());
    } catch (IllegalArgumentException e) {
      throw new UnknownCommandException("unknown command: " + parts.get(0).toLowerCase());
    }
View Full Code Here

        }

        // This assumes correct order in the enum. If that ever changes, we will have to scan for 'code' field.
        BinaryCommand bcmd = BinaryCommand.values()[opcode];

        Command cmdType = bcmd.correspondingCommand;
        CommandMessage cmdMessage = CommandMessage.command(cmdType);
        cmdMessage.noreply = bcmd.noreply;
        cmdMessage.cas_key = cas;
        cmdMessage.opaque = opaque;
        cmdMessage.addKeyToResponse = bcmd.addKeyToResponse;
View Full Code Here

            this.code = (short)code;
        }
    }

    public ResponseCode getStatusCode(ResponseMessage command) {
        Command cmd = command.cmd.cmd;
        if (cmd == Command.GET || cmd == Command.GETS) {
            return ResponseCode.OK;
        } else if (cmd == Command.SET || cmd == Command.CAS || cmd == Command.ADD || cmd == Command.REPLACE || cmd == Command.APPEND  || cmd == Command.PREPEND) {
            switch (command.response) {
                case EXISTS:
View Full Code Here

        }

        // This assumes correct order in the enum. If that ever changes, we will have to scan for 'code' field.
        BinaryCommand bcmd = BinaryCommand.values()[opcode];

        Command cmdType = bcmd.correspondingCommand;
        CommandMessage cmdMessage = CommandMessage.command(cmdType);
        cmdMessage.noreply = bcmd.noreply;
        cmdMessage.cas_key = cas;
        cmdMessage.opaque = opaque;
        cmdMessage.addKeyToResponse = bcmd.addKeyToResponse;
View Full Code Here

            this.code = (short)code;
        }
    }

    public ResponseCode getStatusCode(ResponseMessage command) {
        Command cmd = command.cmd.cmd;
        if (cmd == Command.GET || cmd == Command.GETS) {
            return ResponseCode.OK;
        } else if (cmd == Command.SET || cmd == Command.CAS || cmd == Command.ADD || cmd == Command.REPLACE || cmd == Command.APPEND  || cmd == Command.PREPEND) {
            switch (command.response) {
View Full Code Here

     */
    private void processLine(String[] parts, Channel channel, ChannelHandlerContext channelHandlerContext) throws UnknownCommandException, MalformedCommandException {
        final int numParts = parts.length;

        // Turn the command into an enum for matching on
        Command cmdType;
        try {
            cmdType = Command.valueOf(parts[0].toUpperCase());
        } catch (IllegalArgumentException e) {
            throw new UnknownCommandException("unknown command: " + parts[0].toLowerCase());
        }
View Full Code Here

    @Override
    public void messageReceived(ChannelHandlerContext channelHandlerContext, MessageEvent messageEvent) throws Exception {
        ResponseMessage command = (ResponseMessage) messageEvent.getMessage();

        Command cmd = command.cmd.cmd;

        Channel channel = messageEvent.getChannel();
        if (cmd == Command.GET || cmd == Command.GETS) {
            MCElement[] results = command.elements;
            for (MCElement result : results) {
View Full Code Here

TOP

Related Classes of com.thimbleware.jmemcached.protocol.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.