if (destination instanceof JmsTopic) {
Enumeration names = _database.getAdapter().getDurableConsumers(
connection, destination.getName());
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
Consumer consumer = (Consumer) consumers.get(name);
if (consumer == null) {
consumer = new Consumer(name, null);
consumers.put(name, consumer);
}
Subscription subscription = getSubscription(name,
destination);
consumer.addSubscription(subscription);
}
} else {
final String name = destination.getName();
Consumer consumer = (Consumer) consumers.get(name);
if (consumer == null) {
consumer = new Consumer((JmsQueue) destination);
consumers.put(name, consumer);
}
Subscription subscription = getSubscription(name, destination);
consumer.addSubscription(subscription);
}
}
_database.commit();
return consumers.values();
}