ShardedJedis jedis = getResource();
try {
Jedis j = jedis.getShard(queueUrl + "-" + shard + "-" + CQSConstants.REDIS_STATE);
j.watch(queueUrl + "-" + shard + "-" + CQSConstants.REDIS_STATE);
if (checkOldState) {
String oldStateStr = j.hget(queueUrl + "-" + shard + "-" + CQSConstants.REDIS_STATE, CQSConstants.REDIS_STATE);
if (oldState == null && oldStateStr != null) {
throw new SetFailedException();
}
if (oldState != null) {
if (oldStateStr == null || QCacheState.valueOf(oldStateStr) != oldState) {