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

Examples of com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection


        }

        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


        }
        if (list == null) return;
        Iterator itr = list.iterator();
        while (itr.hasNext()) {
            ConnectionUID uid = (ConnectionUID)itr.next();
            IMQConnection con = (IMQConnection)Globals.getConnectionManager()
                                .getConnection(uid);
            String reason = null;
            try {
                reason = (String)reasonlist.removeFirst();
            } catch (Exception e) {
                logger.log(Logger.DEBUG,"Can't get reason string for destroying connection " + uid);
            }
            if (reason == null) reason = "REASON NOTFOUND";
            if (con != null && con.isValid()) {
                try {
                    con.destroyConnection(false,GoodbyeReason.CLIENT_CLOSED, reason);
                } catch (Exception ex) {
                    logger.logStack(Logger.DEBUG,"error destroying connection " + con , ex);
                }
            }
            itr.remove();
View Full Code Here

        }
        if (list == null) return;
        Iterator itr = list.iterator();
        while (itr.hasNext()) {
            ConnectionUID uid = (ConnectionUID)itr.next();
            IMQConnection con = (IMQConnection)Globals.getConnectionManager()
                                .getConnection(uid);
            String reason = null;
            try {
                reason = (String)reasonlist.removeFirst();
            } catch (Exception e) {
                logger.log(Logger.DEBUG,"Can't get reason string for destroying connection " + uid);
            }
            if (reason == null) reason = "REASON NOTFOUND";
            if (con != null && con.isValid()) {
                try {
                    con.destroyConnection(false,GoodbyeReason.CLIENT_CLOSED, reason);
                } catch (Exception ex) {
                    logger.logStack(Logger.DEBUG,"error destroying connection " + con , ex);
                }
            }
            itr.remove();
View Full Code Here

    }

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

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

  cxnInfo = cxn.getConnectionInfo();

  return (cxnInfo);
    }
View Full Code Here


    public static List getConsumerIDs(long cxnId)  {
  ConnectionManager  cm = Globals.getConnectionManager();
  ConnectionInfo    cxnInfo = null;
  IMQConnection    cxn = null;
  List      consumerIDs;

  cxn = (IMQConnection)cm.getConnection(new ConnectionUID(cxnId));
  consumerIDs = cxn.getConsumersIDs();

  return (consumerIDs);
    }
View Full Code Here

    }

    public static List getProducerIDs(long cxnId)  {
  ConnectionManager  cm = Globals.getConnectionManager();
  ConnectionInfo    cxnInfo = null;
  IMQConnection    cxn = null;
  List      producerIDs;

  cxn = (IMQConnection)cm.getConnection(new ConnectionUID(cxnId));
  producerIDs = cxn.getProducerIDs();

  return (producerIDs);
    }
View Full Code Here

  return (producerIDs);
    }

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

  }
    }

    public static void destroyConnection(String serviceName, String reasonString)  {
  List      cxnList = getConnections(serviceName);
  IMQConnection    cxn = null;

  /*
   * Return if no connections to destroy
   */
  if ((cxnList == null) || (cxnList.size() == 0))  {
      return;
  }

        Iterator iter = cxnList.iterator();

        while (iter.hasNext()) {
      cxn     = (IMQConnection)iter.next();

      if (cxn != null)  {
          cxn.destroyConnection(true, GoodbyeReason.ADMIN_KILLED_CON,
            reasonString);
      }
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection

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.