fail("exception while sleep " + e);
}*/
}
//delete redis queue
RedisSortedSetPersistence redisP = RedisSortedSetPersistence.getInstance();
try{
boolean brokenJedis = false;
ShardedJedis jedis = null;
int shard = 0;
try {
long ts1 = System.currentTimeMillis();
jedis = redisP.getResource();
Long clearNum = jedis.del(ralativeUrl + "-" + shard + "-" + CQSConstants.REDIS_STATE);
logger.debug("num removed=" + clearNum);
clearNum = jedis.del(ralativeUrl + "-" + shard + "-Q");
logger.debug("num removed=" + clearNum);
clearNum = jedis.del(ralativeUrl + "-" + shard + "-F");
logger.debug("num removed=" + clearNum);
long ts2 = System.currentTimeMillis();
CQSControllerServlet.valueAccumulator.addToCounter(AccumulatorName.RedisTime, (ts2 - ts1));
logger.debug("event=cleared_queue queue_url=" + queueUrl + " shard=" + shard);
} catch (JedisConnectionException e) {
logger.warn("event=clear_queue error_code=redis_unavailable num_connections=");
brokenJedis = true;
} finally {
if (jedis != null) {
redisP.returnResource(jedis, brokenJedis);
}
}
//end of clear cache
logger.info("message_count after delete"+redisP.getCacheQueueMessageCount(ralativeUrl));
//test redis queue count is 0
assertTrue("wrong message count in Redis: " + redisP.getCacheQueueMessageCount(ralativeUrl), redisP.getCacheQueueMessageCount(ralativeUrl)==0);
//test if retrieve can get the same number of message and same body of message after cache filler
Map <String, String> resultMap = new HashMap<String, String>();
for (int i = 0; i < num; i ++) {
ReceiveMessageResult result = cqs1.receiveMessage(new ReceiveMessageRequest(queueUrl));
if (i == 0) {