use of com.sun.messaging.jmq.jmsserver.service.ConnectionManager in project openmq by eclipse-ee4j.
the class DestinationList method closeAttachedConnections.
private void closeAttachedConnections(int reason, String reasonStr) {
ConnectionManager cmgr = Globals.getConnectionManager();
ConnectionUID cuid = null;
Connection con = null;
synchronized (connections) {
logger.log(logger.INFO, "Sending good-bye to all assigned connections(" + connections.size() + ") for partition " + this);
ConnectionUID[] conids = connections.toArray(new ConnectionUID[connections.size()]);
for (int i = 0; i < conids.length; i++) {
cuid = conids[i];
con = cmgr.getConnection(cuid);
if (con == null) {
connections.remove(cuid);
continue;
}
con.closeConnection(true, reason, reasonStr);
connections.remove(cuid);
}
}
}
use of com.sun.messaging.jmq.jmsserver.service.ConnectionManager in project openmq by eclipse-ee4j.
the class ConnectionUtil method getConsumerIDs.
public static List getConsumerIDs(long cxnId) {
ConnectionManager cm = Globals.getConnectionManager();
IMQConnection cxn = null;
List consumerIDs;
cxn = (IMQConnection) cm.getConnection(new ConnectionUID(cxnId));
consumerIDs = cxn.getConsumersIDs();
return (consumerIDs);
}
use of com.sun.messaging.jmq.jmsserver.service.ConnectionManager in project openmq by eclipse-ee4j.
the class ConnectionUtil method getConnectionInfo.
/**
* Returns the ConnectionInfo for the passed connection ID.
*/
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.ConnectionManager in project openmq by eclipse-ee4j.
the class ConnectionUtil method getConnectionInfoList.
/**
* Returns a List of ConnectionInfo for the given service or all services if the passed service is null.
*/
public static List getConnectionInfoList(String service) {
ConnectionManager cm = Globals.getConnectionManager();
List connections, connectionInfoList = new ArrayList();
IMQConnection cxn;
ConnectionInfo cxnInfo;
try {
Service s = null;
if (service != null) {
s = Globals.getServiceManager().getService(service);
/*
* If service object is null, service may not exist or is inactive
*/
if (s == null) {
return (connectionInfoList);
}
}
connections = cm.getConnectionList(s);
} catch (Exception e) {
BrokerResources rb = Globals.getBrokerResources();
Logger logger = Globals.getLogger();
logger.log(Logger.WARNING, rb.getString(rb.W_JMX_FAILED_TO_OBTAIN_CONNECTION_LIST), e);
return (connectionInfoList);
}
if (connections.size() == 0) {
return (connectionInfoList);
}
Iterator iter = connections.iterator();
while (iter.hasNext()) {
cxn = (IMQConnection) iter.next();
cxnInfo = cxn.getConnectionInfo();
connectionInfoList.add(cxnInfo);
}
return (connectionInfoList);
}
use of com.sun.messaging.jmq.jmsserver.service.ConnectionManager 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;
}
Aggregations