blob: 03fa8686e73fa76911213c6094bc7ca39e3e236b [file] [log] [blame]
package com.gemstone.gemfire.internal.redis.executor;
import java.util.List;
import com.gemstone.gemfire.internal.redis.Command;
import com.gemstone.gemfire.internal.redis.Coder;
import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
public class EchoExecutor extends AbstractExecutor {
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
List<byte[]> commandElems = command.getProcessedCommand();
if (commandElems.size() < 2) {
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ECHO));
return;
}
byte[] echoMessage = commandElems.get(1);
command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), echoMessage));
}
}