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;
}
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;
}
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));
}
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);
}
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;
}
Aggregations