protected void printSubscribers(PrintWriter writer, Map clients, Map destinations, String type,
ObjectName[] subscribers) {
for (int i = 0; i < subscribers.length; i++) {
ObjectName name = subscribers[i];
SubscriptionViewMBean subscriber = (SubscriptionViewMBean) MBeanServerInvocationHandler.newProxyInstance(
mbeanServer, name, SubscriptionViewMBean.class, true);
String clientId = subscriber.getClientId();
String safeClientId = asID(clientId);
clients.put(safeClientId, clientId);
String destination = subscriber.getDestinationName();
String safeDestinationId = type + asID(destination);
destinations.put(safeDestinationId, destination);
String selector = subscriber.getSelector();
// lets write out the links
String subscriberId = safeClientId + "_" + subscriber.getSessionId() + "_" + subscriber.getSubcriptionId();
writer.print(subscriberId);
writer.print(" -> ");
writer.print(safeClientId);
writer.println(";");
writer.print(safeDestinationId);
writer.print(" -> ");
writer.print(subscriberId);
writer.println(";");
// now lets write out the label
writer.print(subscriberId);
writer.print(" [label = \"");
String label = "Subscription: " + subscriber.getSessionId() + "-" + subscriber.getSubcriptionId();
if (selector != null && selector.length() > 0) {
label = label + "\\nSelector: " + selector;
}
writer.print(label);
writer.println("\"];");