Search in sources :

Example 1 with ProducerUID

use of com.sun.messaging.jmq.jmsserver.core.ProducerUID in project openmq by eclipse-ee4j.

the class DebugHandler method getDebugInfo.

public Hashtable getDebugInfo(String arg, String target, String targetType, Properties p) throws Exception {
    if (arg.equals("cxn")) {
        if (target == null) {
            return getAllCxnInfo(null);
        } else {
            ConnectionUID uid = new ConnectionUID(Long.parseLong(target));
            return getCxnInfo(uid);
        }
    } else if (arg.equals("config")) {
        return getConfig();
    } else if (arg.equals("memory")) {
        return getMemory();
    } else if (arg.equals("dst")) {
        if (target == null) {
            return DL.getAllDebugState();
        } else {
            boolean isQueue = false;
            if (targetType == null) {
                throw new Exception("topic or queue not " + "specified with -t [t|q]");
            } else if (targetType.equals("t")) {
                isQueue = false;
            } else if (targetType.equals("q")) {
                isQueue = true;
            } else {
                throw new Exception("Unknown -t argument " + targetType + " expected t or q");
            }
            DestinationUID uid = DestinationUID.getUID(target, isQueue);
            return getDestinationInfo(uid);
        }
    } else if (arg.equals("ses")) {
        if (target == null) {
            return Session.getAllDebugState();
        } else {
            SessionUID uid = new SessionUID(Long.parseLong(target));
            return getSession(uid);
        }
    } else if (arg.equals("prd")) {
        if (target == null) {
            return Producer.getAllDebugState();
        } else {
            ProducerUID uid = new ProducerUID(Long.parseLong(target));
            return getProducerInfo(uid);
        }
    } else if (arg.equals("con")) {
        if (target == null) {
            return Consumer.getAllDebugState();
        } else {
            ConsumerUID uid = new ConsumerUID(Long.parseLong(target));
            return getConInfo(uid);
        }
    } else if (arg.equals("svc")) {
        if (target == null) {
            logger.log(Logger.INFO, "XXX - target of null " + "not implemented for " + arg);
        } else {
            return getSvcInfo(target);
        }
    } else if (arg.equals("db")) {
        return getDBInfo();
    } else if (arg.equals("trans")) {
        if (target == null) {
            return getTransactionInfo(null);
        } else {
            TransactionUID uid = new TransactionUID(Long.parseLong(target));
            return getTransactionInfo(uid);
        }
    } else if (arg.equals("pool")) {
        if (target == null) {
            logger.log(Logger.INFO, "XXX - target of null " + "not implemented for " + arg);
        } else {
            return getThreadPoolInfo(target);
        }
    } else if (arg.equals("threads")) {
        return SupportUtil.getAllStackTracesAsMap();
    } else if (arg.equals("cls")) {
        return getClusterInfo();
    } else if (arg.equals("bkr")) {
        return getBrokerInfo();
    } else if (arg.equals("pkt")) {
        String full = p.getProperty("full");
        boolean fullDump = false;
        if (full != null && full.equalsIgnoreCase("True")) {
            fullDump = true;
        }
        return getPktInfo(target, targetType, fullDump);
    }
    logger.log(Logger.INFO, "Unknown dump arg " + arg);
    return null;
}
Also used : TransactionUID(com.sun.messaging.jmq.jmsserver.data.TransactionUID) DestinationUID(com.sun.messaging.jmq.jmsserver.core.DestinationUID) SessionUID(com.sun.messaging.jmq.jmsserver.core.SessionUID) ProducerUID(com.sun.messaging.jmq.jmsserver.core.ProducerUID) ConsumerUID(com.sun.messaging.jmq.jmsserver.core.ConsumerUID) ConnectionUID(com.sun.messaging.jmq.jmsserver.service.ConnectionUID)

Example 2 with ProducerUID

use of com.sun.messaging.jmq.jmsserver.core.ProducerUID in project openmq by eclipse-ee4j.

the class ProducerSpi method getAllDebugState.

public static Hashtable getAllDebugState() {
    Hashtable ht = new Hashtable();
    ht.put("TABLE", "AllProducers");
    Vector v = new Vector();
    synchronized (cache) {
        Iterator itr = cache.keySet().iterator();
        while (itr.hasNext()) {
            v.add(String.valueOf(((ProducerUID) itr.next()).longValue()));
        }
    }
    ht.put("cache", v);
    HashMap<ProducerUID, ProducerSpi> tmp = null;
    synchronized (allProducers) {
        tmp = new HashMap<>(allProducers);
    }
    Hashtable producers = new Hashtable();
    Iterator<Map.Entry<ProducerUID, ProducerSpi>> itr = tmp.entrySet().iterator();
    Map.Entry<ProducerUID, ProducerSpi> pair = null;
    while (itr.hasNext()) {
        pair = itr.next();
        ProducerUID p = pair.getKey();
        ProducerSpi producer = pair.getValue();
        producers.put(String.valueOf(p.longValue()), producer.getDebugState());
    }
    ht.put("producersCnt", Integer.valueOf(allProducers.size()));
    ht.put("producers", producers);
    return ht;
}
Also used : ProducerUID(com.sun.messaging.jmq.jmsserver.core.ProducerUID) CacheHashMap(com.sun.messaging.jmq.util.CacheHashMap)

Example 3 with ProducerUID

use of com.sun.messaging.jmq.jmsserver.core.ProducerUID in project openmq by eclipse-ee4j.

the class ProducerManagerMonitor method getNumWildcardProducers.

public Integer getNumWildcardProducers(String wildcard) throws MBeanException {
    int numWildcardProducers = Producer.getNumWildcardProducers();
    if (numWildcardProducers <= 0) {
        return (Integer.valueOf(0));
    }
    Iterator producers = Producer.getWildcardProducers();
    if (producers == null) {
        return (Integer.valueOf(0));
    }
    int count = 0;
    while (producers.hasNext()) {
        ProducerUID pid = (ProducerUID) producers.next();
        Producer oneProd = (Producer) Producer.getProducer(pid);
        /*
             * 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 : DestinationUID(com.sun.messaging.jmq.jmsserver.core.DestinationUID) Producer(com.sun.messaging.jmq.jmsserver.core.Producer) ProducerUID(com.sun.messaging.jmq.jmsserver.core.ProducerUID) Iterator(java.util.Iterator)

Example 4 with ProducerUID

use of com.sun.messaging.jmq.jmsserver.core.ProducerUID in project openmq by eclipse-ee4j.

the class ProducerUtil method getProducerInfo.

public static CompositeData getProducerInfo(String producerID) throws BrokerException, OpenDataException {
    CompositeData cd = null;
    ProducerUID pid = null;
    BrokerResources rb = Globals.getBrokerResources();
    if (producerID == null) {
        throw new IllegalArgumentException(rb.getString(rb.X_JMX_NULL_PRODUCER_ID_SPEC));
    }
    long longPid = 0;
    try {
        longPid = Long.parseLong(producerID);
    } catch (NumberFormatException e) {
        throw new IllegalArgumentException(rb.getString(rb.X_JMX_INVALID_PRODUCER_ID_SPEC, producerID));
    }
    pid = new ProducerUID(longPid);
    cd = getProducerInfo(pid);
    return (cd);
}
Also used : ProducerUID(com.sun.messaging.jmq.jmsserver.core.ProducerUID) CompositeData(javax.management.openmbean.CompositeData) BrokerResources(com.sun.messaging.jmq.jmsserver.resources.BrokerResources)

Example 5 with ProducerUID

use of com.sun.messaging.jmq.jmsserver.core.ProducerUID in project openmq by eclipse-ee4j.

the class DataHandler method checkFlow.

public Producer checkFlow(Packet msg, IMQConnection con) {
    Producer pausedProducer = null;
    // check and clearout the F bit (before anything)
    if (msg.getFlowPaused()) {
        con.flowPaused(0);
        msg.setFlowPaused(false);
    }
    long pid = msg.getProducerID();
    ProducerUID puid = new ProducerUID(pid);
    Producer p = (Producer) Producer.getProducer(puid);
    if (p != null) {
        // increment counter
        p.addMsg();
    }
    // see if we need to resume flow
    if (msg.getConsumerFlow()) {
        pausedProducer = p;
        if (pausedProducer == null) {
            logger.log(Logger.WARNING, "Unknown ProducerUID " + puid);
        } else if (pausedProducer.getConnectionUID() != con.getConnectionUID()) {
            logger.log(Logger.WARNING, "Producer " + pausedProducer + " not on this connection " + con.getConnectionUID());
        }
        msg.setConsumerFlow(false);
    }
    return pausedProducer;
}
Also used : Producer(com.sun.messaging.jmq.jmsserver.core.Producer) ProducerUID(com.sun.messaging.jmq.jmsserver.core.ProducerUID)

Aggregations

ProducerUID (com.sun.messaging.jmq.jmsserver.core.ProducerUID)12 DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)6 Producer (com.sun.messaging.jmq.jmsserver.core.Producer)5 Iterator (java.util.Iterator)5 Session (com.sun.messaging.jmq.jmsserver.core.Session)3 SessionUID (com.sun.messaging.jmq.jmsserver.core.SessionUID)3 ConsumerUID (com.sun.messaging.jmq.jmsserver.core.ConsumerUID)2 Destination (com.sun.messaging.jmq.jmsserver.core.Destination)2 ConnectionUID (com.sun.messaging.jmq.jmsserver.service.ConnectionUID)2 List (java.util.List)2 MBeanException (javax.management.MBeanException)2 FaultInjection (com.sun.messaging.jmq.jmsserver.FaultInjection)1 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)1 TransactionUID (com.sun.messaging.jmq.jmsserver.data.TransactionUID)1 ConsumerSpi (com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi)1 BrokerResources (com.sun.messaging.jmq.jmsserver.resources.BrokerResources)1 Service (com.sun.messaging.jmq.jmsserver.service.Service)1 IMQConnection (com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection)1 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)1 CacheHashMap (com.sun.messaging.jmq.util.CacheHashMap)1