Merge pull request #718 from HeartSaVioR/pubsub-numsub-output-changed
Follow up changes on "pubsub numsub" output (Fixes #714)
This commit is contained in:
@@ -105,6 +105,26 @@ public class BuilderFactory {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final Builder<Map<String, String>> PUBSUB_NUMSUB_MAP = new Builder<Map<String, String>>() {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Map<String, String> build(Object data) {
|
||||||
|
final List<Object> flatHash = (List<Object>) data;
|
||||||
|
final Map<String, String> hash = new HashMap<String, String>();
|
||||||
|
final Iterator<Object> iterator = flatHash.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
hash.put(SafeEncoder.encode((byte[]) iterator.next()),
|
||||||
|
String.valueOf((Long) iterator.next()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "PUBSUB_NUMSUB_MAP<String, String>";
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
public static final Builder<Set<String>> STRING_SET = new Builder<Set<String>>() {
|
public static final Builder<Set<String>> STRING_SET = new Builder<Set<String>>() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Set<String> build(Object data) {
|
public Set<String> build(Object data) {
|
||||||
|
|||||||
@@ -3388,7 +3388,7 @@ public class Jedis extends BinaryJedis implements JedisCommands,
|
|||||||
public Map<String, String> pubsubNumSub(String... channels) {
|
public Map<String, String> pubsubNumSub(String... channels) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.pubsubNumSub(channels);
|
client.pubsubNumSub(channels);
|
||||||
return BuilderFactory.STRING_MAP
|
return BuilderFactory.PUBSUB_NUMSUB_MAP
|
||||||
.build(client.getBinaryMultiBulkReply());
|
.build(client.getBinaryMultiBulkReply());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user