use of com.sun.messaging.jmq.jmsserver.service.ConnectionUID in project openmq by eclipse-ee4j.
the class GetConsumersHandler method getConnectionInfo.
public static ConnectionInfo getConnectionInfo(long id) {
ConnectionManager cm = Globals.getConnectionManager();
ConnectionInfo cxnInfo = null;
IMQConnection cxn = null;
cxn = (IMQConnection) cm.getConnection(new ConnectionUID(id));
if (cxn == null) {
return (null);
}
cxnInfo = cxn.getConnectionInfo();
return (cxnInfo);
}
use of com.sun.messaging.jmq.jmsserver.service.ConnectionUID in project openmq by eclipse-ee4j.
the class GetConsumersHandler method getServiceName.
private static String getServiceName(ConsumerUID cid) {
ConnectionUID cxnId = getConnectionUID(cid);
if (cxnId == null) {
return (null);
}
String serviceName = getServiceOfConnection(cxnId.longValue());
return (serviceName);
}
use of com.sun.messaging.jmq.jmsserver.service.ConnectionUID 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.service.ConnectionUID in project openmq by eclipse-ee4j.
the class DebugHandler method getPktInfo.
private Hashtable getPktInfo(String target, String type, boolean full) throws Exception {
Hashtable ht = new Hashtable();
if (type == null || type.length() == 0 || type.equals("bkr")) {
Hashtable dest = new Hashtable();
Iterator[] itrs = DL.getAllDestinations(null);
Iterator itr = itrs[0];
while (itr.hasNext()) {
Destination d = (Destination) itr.next();
dest.put(d.getDestinationUID().toString(), d.getDebugMessages(full));
}
ht.put("Destinations", dest);
// XXX LKS 1/8/2004
// add entries for sessions, etc
//
} else if (type.equals("q") || type.equals("t")) {
boolean isQueue = false;
if (type.equals("t")) {
isQueue = false;
} else if (type.equals("q")) {
isQueue = true;
}
DestinationUID uid = DestinationUID.getUID(target, isQueue);
Destination[] ds = DL.getDestination(null, uid);
Destination d = ds[0];
if (d == null) {
throw new Exception("Unknown destination " + uid);
} else {
ht.putAll(d.getDebugMessages(full));
}
} else if (type.equals("con")) {
if (target == null) {
throw new Exception("Please specify consumerUID");
} else {
ConsumerUID uid = new ConsumerUID(Long.parseLong(target));
Consumer c = Consumer.getConsumer(uid);
if (c == null) {
throw new Exception("Unknown consumer " + uid);
} else {
ht.put(uid.toString(), c.getDebugMessages(full));
}
}
} else if (type.equals("cxn")) {
if (target == null) {
throw new Exception("Please specify connectionUID");
}
ConnectionUID uid = new ConnectionUID(Long.parseLong(target));
IMQConnection cxn = (IMQConnection) Globals.getConnectionManager().getConnection(uid);
if (cxn == null) {
throw new Exception("Can not find connection " + uid);
}
ht.put(target, cxn.getDebugMessages(full));
} else if (type.equals("ses")) {
ht.put("Dump acks ", target);
if (target == null) {
throw new Exception("Please specify SessionUID");
}
SessionUID uid = new SessionUID(Long.parseLong(target));
Session sess = Session.getSession(uid);
if (sess == null) {
throw new Exception("Can not find session " + uid);
}
ht.put(target, sess.getDebugMessages(full));
} else {
ht.put("Error", "Unknown pkt type " + type);
}
return ht;
}
use of com.sun.messaging.jmq.jmsserver.service.ConnectionUID in project openmq by eclipse-ee4j.
the class GetConsumersHandler method getHost.
private static String getHost(ConsumerUID cid) {
ConnectionUID cxnId = getConnectionUID(cid);
if (cxnId == null) {
return (null);
}
ConnectionInfo cxnInfo = getConnectionInfo(cxnId.longValue());
if (cxnInfo == null) {
return (null);
}
String host = null;
if (cxnInfo.remoteIP != null) {
host = String.valueOf(IPAddress.rawIPToString(cxnInfo.remoteIP, true, true));
}
return (host);
}
Aggregations