Search in sources :

Example 1 with ConnectionManager

use of com.sun.messaging.jmq.jmsserver.service.ConnectionManager 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);
}
Also used : ConnectionManager(com.sun.messaging.jmq.jmsserver.service.ConnectionManager) IMQConnection(com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection) ConnectionUID(com.sun.messaging.jmq.jmsserver.service.ConnectionUID) ConnectionInfo(com.sun.messaging.jmq.util.admin.ConnectionInfo)

Example 2 with ConnectionManager

use of com.sun.messaging.jmq.jmsserver.service.ConnectionManager in project openmq by eclipse-ee4j.

the class DestinationList method destroyConnections.

private static void destroyConnections(Set destroyConns, int reason, String reasonstr) {
    ConnectionManager cm = Globals.getConnectionManager();
    Iterator cnitr = destroyConns.iterator();
    while (cnitr.hasNext()) {
        IMQBasicConnection conn = (IMQBasicConnection) cm.getConnection((ConnectionUID) cnitr.next());
        if (conn == null) {
            continue;
        }
        Globals.getLogger().log(Logger.INFO, "Destroying connection " + conn + " because " + reasonstr);
        if (DEBUG) {
            conn.dump();
        }
        conn.destroyConnection(true, reason, reasonstr);
        conn.waitForRelease(Globals.getConfig().getLongProperty(Globals.IMQ + "." + conn.getService().getName() + ".destroy_timeout", 30) * 1000);
    }
}
Also used : ConnectionManager(com.sun.messaging.jmq.jmsserver.service.ConnectionManager) ConnectionUID(com.sun.messaging.jmq.jmsserver.service.ConnectionUID) IMQBasicConnection(com.sun.messaging.jmq.jmsserver.service.imq.IMQBasicConnection)

Example 3 with ConnectionManager

use of com.sun.messaging.jmq.jmsserver.service.ConnectionManager in project openmq by eclipse-ee4j.

the class ConnectionUtil method getProducerIDs.

public static List getProducerIDs(long cxnId) {
    ConnectionManager cm = Globals.getConnectionManager();
    IMQConnection cxn = null;
    List producerIDs;
    cxn = (IMQConnection) cm.getConnection(new ConnectionUID(cxnId));
    producerIDs = cxn.getProducerIDs();
    return (producerIDs);
}
Also used : ConnectionManager(com.sun.messaging.jmq.jmsserver.service.ConnectionManager) IMQConnection(com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection) List(java.util.List) ArrayList(java.util.ArrayList) ConnectionUID(com.sun.messaging.jmq.jmsserver.service.ConnectionUID)

Example 4 with ConnectionManager

use of com.sun.messaging.jmq.jmsserver.service.ConnectionManager in project openmq by eclipse-ee4j.

the class ConnectionUtil method destroyConnection.

public static void destroyConnection(long cxnId, String reasonString) {
    ConnectionManager cm = Globals.getConnectionManager();
    IMQConnection cxn = null;
    cxn = (IMQConnection) cm.getConnection(new ConnectionUID(cxnId));
    if (cxn != null) {
        cxn.destroyConnection(true, GoodbyeReason.ADMIN_KILLED_CON, reasonString);
    }
}
Also used : ConnectionManager(com.sun.messaging.jmq.jmsserver.service.ConnectionManager) IMQConnection(com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection) ConnectionUID(com.sun.messaging.jmq.jmsserver.service.ConnectionUID)

Example 5 with ConnectionManager

use of com.sun.messaging.jmq.jmsserver.service.ConnectionManager in project openmq by eclipse-ee4j.

the class ConnectionUtil method getConnections.

/**
 * Returns a List of IMQConnection for a given service
 */
public static List getConnections(String service) {
    ConnectionManager cm = Globals.getConnectionManager();
    List connections = null;
    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 (connections);
            }
        }
        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 (connections);
}
Also used : ConnectionManager(com.sun.messaging.jmq.jmsserver.service.ConnectionManager) Service(com.sun.messaging.jmq.jmsserver.service.Service) List(java.util.List) ArrayList(java.util.ArrayList) Logger(com.sun.messaging.jmq.util.log.Logger) BrokerResources(com.sun.messaging.jmq.jmsserver.resources.BrokerResources)

Aggregations

ConnectionManager (com.sun.messaging.jmq.jmsserver.service.ConnectionManager)12 ConnectionUID (com.sun.messaging.jmq.jmsserver.service.ConnectionUID)9 IMQConnection (com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection)8 List (java.util.List)5 Service (com.sun.messaging.jmq.jmsserver.service.Service)4 ConnectionInfo (com.sun.messaging.jmq.util.admin.ConnectionInfo)4 ArrayList (java.util.ArrayList)4 BrokerResources (com.sun.messaging.jmq.jmsserver.resources.BrokerResources)2 IMQBasicConnection (com.sun.messaging.jmq.jmsserver.service.imq.IMQBasicConnection)2 Logger (com.sun.messaging.jmq.util.log.Logger)2 Iterator (java.util.Iterator)2 HAMonitorService (com.sun.messaging.jmq.jmsserver.cluster.api.ha.HAMonitorService)1 Connection (com.sun.messaging.jmq.jmsserver.service.Connection)1 MetricManager (com.sun.messaging.jmq.jmsserver.service.MetricManager)1 ServiceManager (com.sun.messaging.jmq.jmsserver.service.ServiceManager)1 IMQService (com.sun.messaging.jmq.jmsserver.service.imq.IMQService)1 ServiceInfo (com.sun.messaging.jmq.util.admin.ServiceInfo)1 Vector (java.util.Vector)1