Package com.sun.messaging.jmq.jmsserver.service

Examples of com.sun.messaging.jmq.jmsserver.service.ConnectionManager


                ServiceManager sm = Globals.getServiceManager();

                // OK .. first stop sending anything out
                sm.stopNewConnections(ServiceType.ADMIN);

                ConnectionManager cmgr = Globals.getConnectionManager();

                Globals.getLogger().logToAll(Logger.INFO,
                                         BrokerResources.I_BROADCAST_GOODBYE);
                int id = GoodbyeReason.SHUTDOWN_BKR;
                String msg =
                    Globals.getBrokerResources().getKString(
                         BrokerResources.M_ADMIN_REQ_SHUTDOWN,
                          requestedBy);

                if (exitCode == getRestartCode()) {
                    id = GoodbyeReason.RESTART_BKR;
                    msg = Globals.getBrokerResources().getKString(
                             BrokerResources.M_ADMIN_REQ_RESTART,
                              requestedBy);
                }
                cmgr.broadcastGoodbye(id, msg);

                Globals.getLogger().logToAll(Logger.INFO,
                                         BrokerResources.I_FLUSH_GOODBYE);
                cmgr.flushControlMessages(1000);
   
                // XXX - should be notify other brokers we are going down ?

                sm.stopAllActiveServices(true);
View Full Code Here


    }

    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();
View Full Code Here

  String errMsg = null;

  String service = (String)cmd_props.get(MessageType.JMQ_SERVICE_NAME);

  ServiceManager sm = Globals.getServiceManager();
  ConnectionManager cm = Globals.getConnectionManager();

        // Get the list of service names from the ServiceManager
  List serviceNames = sm.getAllServiceNames();

        // Iterate through services
View Full Code Here

  if ( DEBUG ) {
            logger.log(Logger.DEBUG, this.getClass().getName() + ": " +
                "DestroyConnections: " + cmd_props);
        }

        ConnectionManager cm = Globals.getConnectionManager();

  String serviceName = (String)cmd_props.get(MessageType.JMQ_SERVICE_NAME);
  Long cxnId = (Long)cmd_props.get(MessageType.JMQ_CONNECTION_ID);

        int status = Status.OK;
        String errMsg = null;

        Service s = null;


        HAMonitorService hamonitor = Globals.getHAMonitorService();
        if (hamonitor != null && hamonitor.inTakeover()) {
            status = Status.ERROR;
            errMsg =  rb.getString(rb.E_CANNOT_PROCEED_TAKEOVER_IN_PROCESS);

            logger.log(Logger.ERROR, this.getClass().getName() + ": " + errMsg);
  }

        if (status == Status.OK) {

            ConnectionInfo cxnInfo = null;
            IMQConnection  cxn = null;
            if (cxnId != null) {

                logger.log(Logger.INFO, BrokerResources.I_DESTROY_CXN,
                       String.valueOf(cxnId.longValue()));
                // Get info for one connection
                cxn = (IMQConnection)cm.getConnection(
                                new ConnectionUID(cxnId.longValue()));
                if (cxn != null) {
                    if (DEBUG) {
                        cxn.dump();
                    }
View Full Code Here

  if ( DEBUG ) {
            logger.log(Logger.DEBUG, this.getClass().getName() + ": " +
                "GetConnections: " + cmd_props);
        }

        ConnectionManager cm = Globals.getConnectionManager();

  String serviceName = (String)cmd_props.get(MessageType.JMQ_SERVICE_NAME);
  Long cxnId = (Long)cmd_props.get(MessageType.JMQ_CONNECTION_ID);

        int status = Status.OK;
        String errMsg = null;

  Vector v = new Vector();

        Service s = null;


  /*
   * Only one of {JMQServiceName,JMQConnectionID} will be set.
   *
   * If JMQServiceName is set, send back only connections on the
   * specified service. If JMQServiceName is not set, send back connections
   * on all services.
   *
   * If JMQConnectionID is set, send back only the specified connection;
   * send back an error if the id specified cannot be found.
   *
   * Scenarios:
   *   JMQServiceName unset, JMQConnectionID unset
   *   -> send back all connections
   *   JMQServiceName=jms, JMQConnectionID unset
   *   -> send back all connections on service 'jms'
   *   JMQServiceName unset, JMQConnectionID=1234
   *   -> send back connection with ID=1234
   *
   * This won't happen but in case it comes across we can do:
   *   JMQServiceName=jms, JMQConnectionID=1234
   *   -> send back connection with ID=1234 on service 'jms'
   */

        if (serviceName != null) {
            s = Globals.getServiceManager().getService(serviceName);
            if (s == null) {
                status = Status.NOT_FOUND;
                errMsg = rb.getString(rb.X_NO_SUCH_SERVICE, serviceName);
            }
        }

        if (status == Status.OK) {

            ConnectionInfo cxnInfo = null;
            IMQConnection  cxn = null;
            if (cxnId != null) {
                // Get info for one connection
                cxn = (IMQConnection)cm.getConnection(
                                new ConnectionUID(cxnId.longValue()));
                if (cxn != null) {
                    if (DEBUG) {
                        cxn.dump();
                    }
                    cxnInfo = cxn.getConnectionInfo();
              v.add(getConnectionInfoHashtable(cxnInfo));
                } else {
                    status = Status.NOT_FOUND;
                    errMsg = rb.getString(rb.E_NO_SUCH_CONNECTION,
                        String.valueOf(cxnId.longValue()));
                }
            } else {
                // Get info for all connections on a service
                List connections = cm.getConnectionList(s);
                Iterator itr = connections.iterator();
                while (itr.hasNext()) {
                    cxn     = (IMQConnection)itr.next();
              cxnInfo = cxn.getConnectionInfo();
              v.add(getConnectionInfoHashtable(cxnInfo));
View Full Code Here

          GoodbyeReason.toString(GoodbyeReason.BKR_IN_TAKEOVER)+":"+brokerid);
    }

    public 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();
View Full Code Here

        return (new Boolean(con.getIsFlowPaused()));
    }

    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);
  }
View Full Code Here

    /**
     * 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,
View Full Code Here

    /**
     * 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,
View Full Code Here

    /**
     * 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);
  }

View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.service.ConnectionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.