Package com.sun.messaging.jmq.util

Examples of com.sun.messaging.jmq.util.UID


                        int updateType, Object oldValue, Object newValue )
                        throws BrokerException {

        String _updatesql = "";

        UID currentID = null;
        boolean myConn = false;
        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            // Get a connection
            DBManager dbMgr = DBManager.getDBManager();
            if ( conn == null ) {
                conn = dbMgr.getConnection( false );
                myConn = true;
            }

            switch (updateType) {
                case HABrokerInfo.UPDATE_VERSION:
                    _updatesql = updateVersionSQL;
                    pstmt = conn.prepareStatement( updateVersionSQL );
                    pstmt.setInt( 1, ((Integer)newValue).intValue() );
                    pstmt.setString( 2, id );
                    pstmt.executeUpdate();
                    pstmt.close();
                    break;
                case HABrokerInfo.UPDATE_URL:
                    _updatesql = updateURLSQL;
                    pstmt = conn.prepareStatement( updateURLSQL );
                    pstmt.setString( 1, (String)newValue );
                    pstmt.setString( 2, id );
                    pstmt.executeUpdate();
                    pstmt.close();
                    break;
                case HABrokerInfo.RESET_TAKEOVER_BROKER_READY_OPERATING:
                    _updatesql = resetTakeoverBrokerSQL;
                    pstmt = conn.prepareStatement( resetTakeoverBrokerSQL );
                    pstmt.setInt( 1, (BrokerState.OPERATING).intValue() );
                    pstmt.setString( 2, id );
                    int updateCnt = pstmt.executeUpdate();
                    pstmt.close();
                    if (updateCnt == 1) {
                        logger.log(logger.INFO,  br.getKString(
                            BrokerResources.I_THIS_BROKER_RESETED_TAKEOVER_BROKER, TAKEOVER_BROKER_COLUMN, id));
                        long ssid = dbMgr.getDAOFactory().getStoreSessionDAO().insert(
                                          conn, id, ((UID)newValue).longValue(), false);
                        logger.log(logger.INFO,  br.getKString(
                            BrokerResources.I_THIS_BROKER_CURRENT_STORE_SESSION, id, String.valueOf(ssid)));
                        currentID = new UID(ssid);
                        break;
                    } else if (updateCnt == 0) {
                        _updatesql = updateStateThisBrokerSQL;
                        if (!updateState( conn, id, BrokerState.OPERATING,
                                          (BrokerState)oldValue, true )) {
View Full Code Here


        byte[] tmn = _tmName.getBytes("UTF-8");
        if (tmn.length > (MAX_TMNAME_LENGTH)) {
            throw new SystemException(
            "TM name "+_tmName+" byte length exceeds "+MAX_RMNAME_LENGTH);
        }
        UID uid = new UID();

        ByteBuffer bf = ByteBuffer.wrap(new byte[Xid.MAXGTRIDSIZE]);
        bf.put((byte)tmn.length);
        bf.put(tmn);
        bf.putLong(uid.longValue());
        xid.setGlobalTransactionId(bf.array());
        return xid;

        } catch (Exception e) {
        if (e instanceof SystemException) throw (SystemException)e;
View Full Code Here

                           BrokerResources.E_INTERNAL_BROKER_ERROR,
                           "invalid URL stored on disk " + urlstr, ex));
             }
             version = new Integer(m.getVersion());
             state = BrokerState.getState(m.getState());
             session = new UID(m.getSessionID());
             takeoverBroker = m.getTakeoverBrokerID();
             heartbeat = m.getHeartbeat();
        }
View Full Code Here

             this.address = url;
             this.version = new Integer(version);
             this.state = state;
             this.session = session;
             this.takeoverBroker = "";
             this.brokerSessionUID = new UID();

             Store store = Globals.getStore();
             store.addBrokerInfo(brokerid, address.toString(), state,
                    this.version.intValue(), session.longValue(),
                    heartbeat);
View Full Code Here

                 logger.logStack(logger.WARNING, ex.getMessage(), ex);
                 address = oldaddr;
             }
             version = new Integer(m.getVersion());
             state = BrokerState.getState(m.getState());
             session = new UID(m.getSessionID());
             takeoverBroker = m.getTakeoverBrokerID();
             heartbeat = m.getHeartbeat();

             }
View Full Code Here

                     Globals.getBrokerResources().getKString(
                     BrokerResources.X_A_BROKER_TAKINGOVER_THIS_BROKER,
                     (otherb == null ? "":otherb), this.toString()));
             }
             try {
                 UID curssid = updateEntry(
                               HABrokerInfo.RESET_TAKEOVER_BROKER_READY_OPERATING,
                               state, getBrokerSessionUID());
                 if (curssid != null) {
                     this.session = curssid;
                     localSessionUID = curssid;
View Full Code Here

         * @param userData optional user data
         * @see ConfigListener
         */
        public void setStatus(int newstatus, Object userData)
        {
            UID uid = null;
            Integer oldstatus = null;
            synchronized (this) {
                if (this.status.intValue() == newstatus)
                    return;
                uid = getBrokerSessionUID();
View Full Code Here

         * @param up setting for the bit flag (true/false)
         */
        public void setBrokerIsUp(boolean up, UID brokerSession, Object userData)
        {
       
            UID uid = brokerSession;
            Integer oldstatus = null;
            Integer newstatus = null;
            synchronized (this) {
                if (!up && !uid.equals(getBrokerSessionUID())) {
                    logger.log(logger.INFO, Globals.getBrokerResources().getKString(
                               BrokerResources.I_DOWN_STATUS_ON_BROKER_SESSION,
                               "[BrokerSession:"+uid+"]", this.toString()));
                    oldstatus = new Integer(BrokerStatus.BROKER_INDOUBT);
                    newstatus = BrokerStatus.setBrokerIsDown(oldstatus);
View Full Code Here

         * @param up setting for the bit flag (true/false)
         */
        public void setBrokerLinkUp(boolean up, Object userData)
        {
       
            UID uid = null;
            Integer oldstatus = null;
            synchronized (this) {
                oldstatus = this.status;

                int newStatus = 0;
View Full Code Here

         * @param up setting for the bit flag (true/false)
         */
        public void setBrokerInDoubt(boolean up, Object userData)
        {
       
            UID uid = (UID)userData;
            Integer oldstatus = null;
            Integer newstatus = null;
            synchronized (this) {
                if (up && !uid.equals(getBrokerSessionUID())) {
                    logger.log(logger.INFO, Globals.getBrokerResources().getKString(
                               BrokerResources.I_INDOUBT_STATUS_ON_BROKER_SESSION,
                               "[BrokerSession:"+uid+"]", this.toString()));
                    oldstatus = new Integer(BrokerStatus.ACTIVATE_BROKER);
                    newstatus = BrokerStatus.setBrokerInDoubt(oldstatus);
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.util.UID

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.