private Object[] listSubscribersInfos(final DurabilityType durability) {
    List<QueueControl> queues = getQueues(durability);
    List<Object[]> subInfos = new ArrayList<>(queues.size());

    for (QueueControl queue : queues) {
      String clientID = null;
      String subName = null;

      if (queue.isDurable()) {
        Pair<String, String> pair =
            ActiveMQDestination.decomposeQueueNameForDurableSubscription(queue.getName());
        clientID = pair.getA();
        subName = pair.getB();
      }

      String filter = queue.getFilter() != null ? queue.getFilter() : null;

      Object[] subscriptionInfo = new Object[6];
      subscriptionInfo[0] = queue.getName();
      subscriptionInfo[1] = clientID;
      subscriptionInfo[2] = subName;
      subscriptionInfo[3] = queue.isDurable();
      subscriptionInfo[4] = queue.getMessageCount();
      subscriptionInfo[5] = filter;
      subInfos.add(subscriptionInfo);
    }
    return subInfos.toArray(new Object[subInfos.size()]);
  }
  private String listSubscribersInfosAsJSON(final DurabilityType durability) throws Exception {
    try {
      List<QueueControl> queues = getQueues(durability);
      JSONArray array = new JSONArray();

      for (QueueControl queue : queues) {
        String clientID = null;
        String subName = null;

        if (queue.isDurable() && !queue.getName().startsWith(ResourceNames.JMS_TOPIC)) {
          Pair<String, String> pair =
              ActiveMQDestination.decomposeQueueNameForDurableSubscription(queue.getName());
          clientID = pair.getA();
          subName = pair.getB();
        } else if (queue.getName().startsWith(ResourceNames.JMS_TOPIC)) {
          // in the case of heirarchical topics the queue name will not follow the <part>.<part>
          // pattern of normal
          // durable subscribers so skip decomposing the name for the client ID and subscription
          // name and just
          // hard-code it
          clientID = "ActiveMQ";
          subName = "ActiveMQ";
        }

        String filter = queue.getFilter() != null ? queue.getFilter() : null;

        JSONObject info = new JSONObject();

        info.put("queueName", queue.getName());
        info.put("clientID", clientID);
        info.put("selector", filter);
        info.put("name", subName);
        info.put("durable", queue.isDurable());
        info.put("messageCount", queue.getMessageCount());
        info.put("deliveringCount", queue.getDeliveringCount());
        info.put("consumers", new JSONArray(queue.listConsumersAsJSON()));
        array.put(info);
      }

      return array.toString();
    } catch (Exception e) {
      e.printStackTrace();
      return e.toString();
    }
  }