use of com.sun.messaging.jmq.jmsserver.service.MetricManager in project openmq by eclipse-ee4j.
the class BrokerMetricsMonitor method getMonitorData.
@Override
protected Hashtable getMonitorData() {
Hashtable mapMessage = new Hashtable();
MetricManager mm = Globals.getMetricManager();
MetricData md = mm.getMetrics();
mapMessage.put("numConnections", Long.valueOf(md.nConnections));
mapMessage.put("numMsgsIn", Long.valueOf(md.totals.messagesIn));
mapMessage.put("numMsgsOut", Long.valueOf(md.totals.messagesOut));
mapMessage.put("numMsgs", Long.valueOf(Globals.getDestinationList().totalCount()));
mapMessage.put("msgBytesIn", Long.valueOf(md.totals.messageBytesIn));
mapMessage.put("msgBytesOut", Long.valueOf(md.totals.messageBytesOut));
mapMessage.put("numPktsIn", Long.valueOf(md.totals.packetsIn));
mapMessage.put("numPktsOut", Long.valueOf(md.totals.packetsOut));
mapMessage.put("pktBytesIn", Long.valueOf(md.totals.packetBytesIn));
mapMessage.put("pktBytesOut", Long.valueOf(md.totals.packetBytesOut));
mapMessage.put("totalMsgBytes", Long.valueOf(Globals.getDestinationList().totalBytes()));
/*
* Calculate number of destinations. We cannot use Destination.destinationsSize() here because that includes all
* destinations. We need to filter out internal/admin destinations - basically what is returned by DestListMonitor.
*/
Iterator[] itrs = Globals.getDestinationList().getAllDestinations(null);
Iterator itr = itrs[0];
long numDests = 0;
while (itr.hasNext()) {
Destination oneDest = (Destination) itr.next();
if (oneDest.isInternal() || oneDest.isAdmin() || (oneDest.getDestinationName().equals(MessageType.JMQ_BRIDGE_ADMIN_DEST)) || (oneDest.getDestinationName().equals(MessageType.JMQ_ADMIN_DEST))) {
continue;
}
numDests++;
}
mapMessage.put("numDestinations", Long.valueOf(numDests));
return mapMessage;
}
use of com.sun.messaging.jmq.jmsserver.service.MetricManager in project openmq by eclipse-ee4j.
the class ServiceManagerMonitor method getMetricsForAllServices.
private MetricCounters getMetricsForAllServices() {
MetricManager mm = Globals.getMetricManager();
MetricCounters mc = null;
mc = mm.getMetricCounters(null);
return (mc);
}
use of com.sun.messaging.jmq.jmsserver.service.MetricManager in project openmq by eclipse-ee4j.
the class GetServicesHandler method getServiceInfo.
public static ServiceInfo getServiceInfo(String name) {
ServiceManager sm = Globals.getServiceManager();
ConnectionManager cm = Globals.getConnectionManager();
MetricManager mm = Globals.getMetricManager();
/*
* XXX REVISIT dipol 10/17/00 we should probably put this logic into the ServiceManager so knowledge of property names
* is encapsulated there.
*/
String proto = props.getProperty(SERVICE_PREFIX + name + ".protocoltype");
// Fill in admin service info object
ServiceInfo si = new com.sun.messaging.jmq.util.admin.ServiceInfo();
si.name = name;
si.protocol = proto;
// strange kludge here ...
// if protocol is tcp or tls, it defaults to 0
int default_value = -1;
if (si.protocol != null) {
if (si.protocol.equals("tcp") || si.protocol.equals("tls")) {
default_value = 0;
}
}
si.port = props.getIntProperty(SERVICE_PREFIX + name + "." + proto + ".port", default_value);
if (si.port == 0) {
si.dynamicPort = true;
} else {
si.dynamicPort = false;
}
si.minThreads = props.getIntProperty(SERVICE_PREFIX + name + ".min_threads");
si.maxThreads = props.getIntProperty(SERVICE_PREFIX + name + ".max_threads");
si.type = sm.getServiceType(name);
Service service = sm.getService(name);
if (service != null) {
si.nConnections = cm.getNumConnections(service);
si.state = service.getState();
if (service instanceof IMQService) {
IMQService ss = (IMQService) service;
si.currentThreads = ss.getActiveThreadpool();
si.minThreads = ss.getMinThreadpool();
si.maxThreads = ss.getMaxThreadpool();
// port number that is acutally being used
if (si.port == 0 && ss.getProtocol() != null) {
si.port = ss.getProtocol().getLocalPort();
}
}
if (mm != null) {
si.metrics = mm.getMetricCounters(name);
} else {
si.metrics = null;
}
} else {
// Service is not intitialized
si.state = ServiceState.UNKNOWN;
}
return si;
}
use of com.sun.messaging.jmq.jmsserver.service.MetricManager in project openmq by eclipse-ee4j.
the class ResetMetricsHandler method resetAllMetrics.
/**
* Handle the incomming administration message.
*/
public static void resetAllMetrics() {
// reset destination
Globals.getDestinationList().resetAllMetrics(null);
// reset all services
List services = Globals.getServiceManager().getAllServiceNames();
Iterator itr = services.iterator();
while (itr.hasNext()) {
String name = (String) itr.next();
IMQService service = (IMQService) Globals.getServiceManager().getService(name);
if (service != null) {
service.resetCounters();
}
}
// reset metrics manager
MetricManager mm = Globals.getMetricManager();
mm.reset();
/*
* Reset metrics that are kept track of by JMX MBeans
*/
Agent agent = Globals.getAgent();
if (agent != null) {
agent.resetMetrics();
}
}
Aggregations