Search in sources :

Example 1 with ProducerSpi

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

the class DestinationMonitor method getProducerWildcards.

public String[] getProducerWildcards() throws MBeanException {
    ArrayList<String> al = new ArrayList<>();
    String[] list = null;
    int numProducers = getNumProducers().intValue();
    Iterator producers;
    if (numProducers <= 0) {
        return (null);
    }
    producers = d.getProducers();
    while (producers.hasNext()) {
        ProducerSpi oneProd = (ProducerSpi) producers.next();
        if (oneProd.isWildcard()) {
            DestinationUID id = oneProd.getDestinationUID();
            al.add(id.getName());
        }
    }
    if (al.size() > 0) {
        list = new String[al.size()];
        list = al.toArray(list);
    }
    return (list);
}
Also used : ProducerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ProducerSpi) DestinationUID(com.sun.messaging.jmq.jmsserver.core.DestinationUID) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 2 with ProducerSpi

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

the class DestinationMonitor method getWildcards.

public String[] getWildcards() throws MBeanException {
    ArrayList<String> al = new ArrayList<>();
    String[] list = null;
    int numConsumers = getNumConsumers().intValue(), numProducers = getNumProducers().intValue();
    if (numConsumers > 0) {
        Iterator consumers = d.getConsumers();
        while (consumers.hasNext()) {
            Consumer oneCon = (Consumer) consumers.next();
            if (oneCon.isWildcard()) {
                DestinationUID id = oneCon.getDestinationUID();
                al.add(id.getName());
            }
        }
    }
    if (numProducers > 0) {
        Iterator producers = d.getProducers();
        while (producers.hasNext()) {
            ProducerSpi oneProd = (ProducerSpi) producers.next();
            if (oneProd.isWildcard()) {
                DestinationUID id = oneProd.getDestinationUID();
                al.add(id.getName());
            }
        }
    }
    if (al.size() > 0) {
        list = new String[al.size()];
        list = al.toArray(list);
    }
    return (list);
}
Also used : ProducerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ProducerSpi) DestinationUID(com.sun.messaging.jmq.jmsserver.core.DestinationUID) Consumer(com.sun.messaging.jmq.jmsserver.core.Consumer) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 3 with ProducerSpi

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

the class DestinationMonitor method getProducerIDs.

public String[] getProducerIDs() throws MBeanException {
    int numProducers = getNumProducers().intValue();
    String[] ids;
    Iterator producers;
    if (numProducers <= 0) {
        return (null);
    }
    producers = d.getProducers();
    ids = new String[numProducers];
    int i = 0;
    while (producers.hasNext()) {
        ProducerSpi oneProd = (ProducerSpi) producers.next();
        long prodID = oneProd.getProducerUID().longValue();
        try {
            ids[i] = Long.toString(prodID);
        } catch (Exception ex) {
            handleOperationException(DestinationOperations.GET_PRODUCER_IDS, ex);
        }
        i++;
    }
    return (ids);
}
Also used : ProducerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ProducerSpi) Iterator(java.util.Iterator) MBeanException(javax.management.MBeanException)

Example 4 with ProducerSpi

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

the class DestinationMonitor method getNumWildcards.

public Integer getNumWildcards() throws MBeanException {
    int numConsumers = getNumConsumers().intValue();
    int numProducers = getNumProducers().intValue();
    int count = 0;
    if (numConsumers > 0) {
        Iterator consumers = d.getConsumers();
        while (consumers.hasNext()) {
            Consumer oneCon = (Consumer) consumers.next();
            if (oneCon.isWildcard()) {
                ++count;
            }
        }
    }
    if (numProducers > 0) {
        Iterator producers = d.getProducers();
        while (producers.hasNext()) {
            ProducerSpi oneProd = (ProducerSpi) producers.next();
            if (oneProd.isWildcard()) {
                ++count;
            }
        }
    }
    return (Integer.valueOf(count));
}
Also used : ProducerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ProducerSpi) Consumer(com.sun.messaging.jmq.jmsserver.core.Consumer) Iterator(java.util.Iterator)

Example 5 with ProducerSpi

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

the class IMQConnection method cleanUpProducers.

/**
 * called when the connection is closed
 */
private void cleanUpProducers() {
    if (Globals.getMemManager() != null) {
        Globals.getMemManager().removeProducer(producers.size());
    }
    synchronized (producers) {
        Iterator itr = producers.values().iterator();
        while (itr.hasNext()) {
            ProducerSpi p = (ProducerSpi) itr.next();
            if (coreLifecycle != null) {
                coreLifecycle.destroyProducer(p.getProducerUID(), "cleanup of connection " + this);
            } else {
                Producer.destroyProducer(p.getProducerUID(), "cleanup of connection " + this);
            }
            itr.remove();
        }
    }
}
Also used : ProducerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ProducerSpi)

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