Search in sources :

Example 6 with ProducerSpi

use of com.sun.messaging.jmq.jmsserver.plugin.spi.ProducerSpi in project openmq by eclipse-ee4j.

the class DestinationMonitor method getNumWildcardProducers.

public Integer getNumWildcardProducers(String wildcard) throws MBeanException {
    int numProducers = getNumProducers().intValue();
    if (numProducers <= 0) {
        return (Integer.valueOf(0));
    }
    Iterator producers = d.getProducers();
    if (producers == null) {
        return (Integer.valueOf(0));
    }
    int count = 0;
    while (producers.hasNext()) {
        ProducerSpi oneProd = (ProducerSpi) producers.next();
        if (oneProd.isWildcard()) {
            /*
                 * If wildcard param is not null, check for matches If it is null, return total count of wildcards
                 */
            if (wildcard != null) {
                DestinationUID id = oneProd.getDestinationUID();
                if (id.getName().equals(wildcard)) {
                    count++;
                }
            } else {
                count++;
            }
        }
    }
    return (Integer.valueOf(count));
}
Also used : ProducerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ProducerSpi) DestinationUID(com.sun.messaging.jmq.jmsserver.core.DestinationUID) Iterator(java.util.Iterator)

Aggregations

ProducerSpi (com.sun.messaging.jmq.jmsserver.plugin.spi.ProducerSpi)6 Iterator (java.util.Iterator)5 DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)3 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)2 ArrayList (java.util.ArrayList)2 MBeanException (javax.management.MBeanException)1