diff --git a/chronosQ-reservation-impl-redis/src/main/java/flipkart/cp/convert/chronosQ/impl/redis/RedisSchedulerStore.java b/chronosQ-reservation-impl-redis/src/main/java/flipkart/cp/convert/chronosQ/impl/redis/RedisSchedulerStore.java index 10fbbdc..c0b72ef 100644 --- a/chronosQ-reservation-impl-redis/src/main/java/flipkart/cp/convert/chronosQ/impl/redis/RedisSchedulerStore.java +++ b/chronosQ-reservation-impl-redis/src/main/java/flipkart/cp/convert/chronosQ/impl/redis/RedisSchedulerStore.java @@ -154,12 +154,16 @@ private List getSchedulerPayloadValues(int partitionNum, Collect return schedulerDataList; try { jedis = _getInstance(partitionNum); - String[] keys = resultSet.toArray(new String[resultSet.size()]); + //https://stackoverflow.com/questions/174093/toarraynew-myclass0-or-toarraynew-myclassmylist-size + String[] keys = resultSet.toArray(new String[0]); List schedulerValues = jedis.mget(keys); Iterator keyIterator = resultSet.iterator(); Iterator valueIterator = schedulerValues.iterator(); while (keyIterator.hasNext() && valueIterator.hasNext()) { - schedulerDataList.add(new DefaultSchedulerEntry(keyIterator.next(), valueIterator.next())); + String key = keyIterator.next(); + String value = valueIterator.next(); + value = "nil".equalsIgnoreCase(value) ? key : value; + schedulerDataList.add(new DefaultSchedulerEntry(key, value)); } } catch (Exception ex) { log.error("Exception occurred for -" + "mget payload for Partition " + partitionNum + "-" + ex.getMessage()); @@ -196,7 +200,7 @@ private String getKey(long time, int partitionNum) { return prefix + convertNumToString(time) + DELIMITER + convertNumToString(partitionNum); } - private String getPayloadKey(String rawKey){ + private String getPayloadKey(String rawKey) { String prefix = keyPrefix != null && !keyPrefix.equals("") ? keyPrefix + DELIMITER : ""; return prefix + rawKey; }