blob: edd9b2834c8f8e45d6eaddb76a7012bc7efb39d5 [file] [log] [blame]
package com.gemstone.gemfire.internal.redis.executor.transactions;
import com.gemstone.gemfire.cache.CacheTransactionManager;
import com.gemstone.gemfire.cache.TransactionId;
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;
public class MultiExecutor extends TransactionExecutor {
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
CacheTransactionManager txm = context.getCacheTransactionManager();
command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
if (context.hasTransaction()) {
throw new IllegalStateException(RedisConstants.ERROR_NESTED_MULTI);
}
txm.begin();
TransactionId id = txm.suspend();
context.setTransactionID(id);
}
}