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

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


            if (!valid) return;
            valid = false;
        }
        logger.log(Logger.DEBUG,"Close Session " + uid);
       
        Connection conn = Globals.getConnectionManager().getConnection(getConnectionUID());
        boolean old = false;
        if (conn != null && conn.getClientProtocolVersion() < Connection.RAPTOR_PROTOCOL) {
            old =true;
        }

        Iterator itr = null;
        synchronized (this) {
            itr = new HashSet(consumers.values()).iterator();
        }
        while (itr.hasNext()) {
            Consumer c =(Consumer)itr.next();
            itr.remove();
            detatchConsumer(c, null, old, false);
        }

        // deal w/ old messages
        synchronized(deliveredMessages) {
            if (!deliveredMessages.isEmpty()) {
                // get the list by IDs
                HashMap openMsgs = new HashMap();
                itr = deliveredMessages.entrySet().iterator();
                while (itr.hasNext()) {
                    Map.Entry entry = (Map.Entry)itr.next();
                    ackEntry e = (ackEntry)entry.getValue();

                    ConsumerUID cuid = e.getConsumerUID();
                    ConsumerUID storeduid = (e.getStoredUID() == null ? cuid:e.getStoredUID());

                    // deal w/ orphan messages
                    TransactionUID tid = e.getTUID();
                    if (tid != null) {
                        JMQXid jmqxid = Globals.getTransactionList().UIDToXid(tid);
                        if (jmqxid != null) {
                            Globals.getTransactionList().addOrphanAck(
                                    tid, e.getSysMessageID(), storeduid, cuid);
                            itr.remove();
                            continue;
                        }
                        TransactionState ts = Globals.getTransactionList().retrieveState(tid, true);
                        if (ts != null && ts.getState() == TransactionState.PREPARED) {
                            Globals.getTransactionList().addOrphanAck(
                                    tid, e.getSysMessageID(), storeduid, cuid);
                            itr.remove();
                            continue;
                        }
                        if (ts != null && ts.getState() == TransactionState.COMMITTED) {
                            itr.remove();
                            continue;
                        }
                        if (ts != null && conn != null &&
                            ts.getState() == TransactionState.COMPLETE &&
                            conn.getConnectionState() >= Connection.STATE_CLOSED) {
                            String[] args = { ""+tid,
                                              TransactionState.toString(ts.getState()),
                                              getConnectionUID().toString() };
                            logger.log(Logger.INFO, Globals.getBrokerResources().getKString(
                                       BrokerResources.I_CONN_CLEANUP_KEEP_TXN, args));
View Full Code Here


    public String getClientID() {
        ConnectionUID cuid = getConnectionUID();
        if (cuid == null) return "<unknown>";

        Connection con = (Connection)Globals.getConnectionManager()
                            .getConnection(cuid);
        return (String)con.getClientData(IMQConnection.CLIENT_ID);
       
    }
View Full Code Here

        Globals.getLogger().log(Logger.DEBUG,"------------------------");
        Globals.getLogger().log(Logger.DEBUG,"Number of connections is " +
                          Globals.getConnectionManager().getNumConnections(null));
        List l = Globals.getConnectionManager().getConnectionList(null);
        for (int i=0; i < l.size(); i ++ ) {
            Connection c= (Connection)l.get(i);
            Globals.getLogger().log(Logger.DEBUG,"\t" + i + "\t" +
                 c.getConnectionUID() + " :" + c.getRemoteConnectionString());
        }
        Globals.getLogger().log(Logger.DEBUG,"------------------------");
    }
View Full Code Here

                  oldCID = new ConnectionUID(longUID.longValue());
                  logger.log(Logger.INFO,
                         BrokerResources.I_RECONNECTING, oldCID);
                  logger.log(Logger.DEBUG,"Checking for active connection");

                  Connection oldcon = Globals.getConnectionManager().getConnection(oldCID);
                  DUMP("Before connection Destroy");
                  if (oldcon != null) {
                      logger.log(Logger.DEBUG,"Destroying old connection " + oldCID);
                      oldcon.destroyConnection(true,GoodbyeReason.ADMIN_KILLED_CON, "Destroying old connection with same connectionUID " + oldCID + " - reconnect is happening before connection was reaped");
                  }
/* LKS
                  DUMP();

                  logger.log(Logger.DEBUG,"Updating connection in id list " +
View Full Code Here

                // lock the combination of namespace and clientID
                String unspace = namespace + "${%%}" + clientid;
                if (!Globals.getClusterBroadcast().lockClientID(unspace, con.getConnectionUID(), false)) {
                  // namespace/clientID combination already in use
                  logger.log(Logger.INFO,BrokerResources.I_CLIENT_ID_IN_USE, con.getRemoteConnectionString(), unspace);
                  Connection owner = Globals.getConnectionManager().matchProperty(IMQConnection.CLIENT_ID,unspace);
                  assert owner == null || owner instanceof IMQConnection;
                  if (owner == null) { // remote
                    logger.log(Logger.INFO, BrokerResources.I_RMT_CID_OWNER, unspace);
                  } else {
                    logger.log(Logger.INFO, BrokerResources.I_LOCAL_CID_OWNER, unspace, ((IMQConnection)owner).getRemoteConnectionString());
                  }
                  reason = "conflict w/ clientID";
                  status = Status.CONFLICT;
                  throw new BrokerException(reason, status);
                }
              }
                
                  // now lock the clientID itself (whether shared or unshared)
                  if (status != Status.CONFLICT && !Globals.getClusterBroadcast().lockClientID(clientid, con.getConnectionUID(), shared)) {
                     // cannot lock clientID
                     logger.log(Logger.INFO,BrokerResources.I_CLIENT_ID_IN_USE, con.getRemoteConnectionString(), clientid);
                     Connection owner = Globals.getConnectionManager().matchProperty(IMQConnection.CLIENT_ID, clientid);
                     assert owner == null || owner instanceof IMQConnection;
                     if (owner == null) { // remote
                         logger.log(Logger.INFO, BrokerResources.I_RMT_CID_OWNER, clientid);
                      } else {
                         logger.log(Logger.INFO, BrokerResources.I_LOCAL_CID_OWNER, clientid, ((IMQConnection)owner).getRemoteConnectionString());
View Full Code Here

TOP

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

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.