public int getDurableConsumerMessageCount(String topic, String name) {
int count = -1;
try {
// first see if the cache is loaded in memory
JmsDestination dest = _destinations.getDestination(topic);
ConsumerEndpoint endpoint = null;
if ((dest != null)
&& ((name != null)
|| (name.length() > 0))) {
endpoint = _consumers.getConsumerEndpoint(name);
if ((endpoint != null)
&& (endpoint.getDestination().equals(dest))) {
// retrieve the number of handles for the endpoint, which
// reflects the number of messages
count = endpoint.getMessageCount();
} else {
// there is no cache with this name stored in memory. If
// this is an administered destination then read the count
// directly from the database.
if (dest.getPersistent()) {