Examples of HABrokerInfo


Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

                    itr.remove();
                } catch (Exception ex) {
                    if ( ex instanceof TakeoverLockException ) {
                        BrokerState state = null;
                        String takeoverBy = null;
                        HABrokerInfo bkrInfo = ((TakeoverLockException)ex).getBrokerInfo();
                        if (bkrInfo == null) {
                            // This shouldn't happens but just in case
                            try {
                                state = cb.getState();
                                takeoverBy = cb.getTakeoverBroker();
                            } catch ( BrokerException e ) {}
                        } else {
                            state = BrokerState.getState(bkrInfo.getState());
                            takeoverBy = bkrInfo.getTakeoverBrokerID();
                        }

                        if ( state == BrokerState.FAILOVER_STARTED ||
                             state == BrokerState.FAILOVER_PENDING ||
                             state == BrokerState.FAILOVER_COMPLETE ) {
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

             * in their own filestore (a.k.a broker filestore).
             */
            Iterator bkrItr = haBrokers.iterator();
            while (bkrItr.hasNext()) {
                // Backup data for each broker
                HABrokerInfo bkrInfo = (HABrokerInfo)bkrItr.next();
                String brokerID = bkrInfo.getId();

                logger.logToAll(Logger.INFO,
                    "Backup persistent data for broker " + brokerID);

                FileStore bkrFS = null;
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

            consumerArray = null;

            // Broker & Session table.
            Iterator bkrItr = haBrokers.iterator();
            while (bkrItr.hasNext()) {
                HABrokerInfo bkrInfo = (HABrokerInfo)bkrItr.next();
                jdbcStore.addBrokerInfo(bkrInfo, false);
            }

            /*
             * For each broker in the cluster, we will retrieve broker specific
             * data, destinations, messages, transactions, acknowledgements
             * from their own filestore (a.k.a broker filestore).
             */
            bkrItr = haBrokers.iterator();
            while (bkrItr.hasNext()) {
                // Backup data for each broker
                HABrokerInfo bkrInfo = (HABrokerInfo)bkrItr.next();
                String brokerID = bkrInfo.getId();
                long sessionID = bkrInfo.getSessionID();

                logger.logToAll(Logger.INFO,
                    "Restore persistent data for broker " + brokerID);

                FileStore bkrFS = null;
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

                        break;
                    } else if (updateCnt == 0) {
                        _updatesql = updateStateThisBrokerSQL;
                        if (!updateState( conn, id, BrokerState.OPERATING,
                                          (BrokerState)oldValue, true )) {
                            HABrokerInfo info = getBrokerInfo( conn, id);
                            throw new BrokerException(
                            "IllegalStateException for updating state "+oldValue+
                            " to "+BrokerState.OPERATING.toString()+": "+info);
                        }
                        break;
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

            pstmt = conn.prepareStatement( updateHeartbeatAndCheckStateSQL );
            pstmt.setLong( 1, heartbeat );
            pstmt.setString( 2, id );
            pstmt.setLong( 3, lastHeartbeat );
            if ( pstmt.executeUpdate() == 0 ) {
                HABrokerInfo bkrInfo = getBrokerInfo( conn, id );
                if ( bkrInfo == null ) {
                    String errorMsg = br.getKString(
                        BrokerResources.E_BROKERINFO_NOT_FOUND_IN_STORE, id );
                    throw new BrokerException( br.getKString(
                        BrokerResources.X_UPDATE_HEARTBEAT_TS_2_FAILED, id, errorMsg ) );
                }

                // Verify if persistent store is being taken over
                String takeoverBroker = bkrInfo.getTakeoverBrokerID();
                int state = bkrInfo.getState();
                if ( takeoverBroker != null && takeoverBroker.length() > 0 &&
                     ( state == BrokerState.I_FAILOVER_PENDING ||
                       state == BrokerState.I_FAILOVER_STARTED ||
                       state == BrokerState.I_FAILOVER_COMPLETE ||
                       state == BrokerState.I_FAILOVER_FAILED ) ) {
                    BrokerException be = new StoreBeingTakenOverException(
                        br.getKString( BrokerResources.E_STORE_BEING_TAKEN_OVER ) );
                    logger.log( Logger.ERROR, br.getKString(
                        BrokerResources.X_UPDATE_HEARTBEAT_TS_2_FAILED, id,
                        bkrInfo.toString() ), be );
                    throw be;
                }
            } else {
                newheartbeat = new Long( heartbeat );
            }
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

     */
    public HABrokerInfo takeover( Connection conn, String id,
        String targetBrokerID, long lastHeartbeat, BrokerState expectedState,
        long newHeartbeat, BrokerState newState) throws BrokerException {

        HABrokerInfo bkrInfo = null;

        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            // Save the broker's state before updating
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

     * @throws BrokerException
     */
    public HABrokerInfo getBrokerInfo( Connection conn, String id )
        throws BrokerException {

        HABrokerInfo bkrInfo = null;

        boolean myConn = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        Exception myex = null;
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

            }

            pstmt = conn.prepareStatement( selectAllSQL );
            rs = pstmt.executeQuery();
            while ( rs.next() ) {
                HABrokerInfo bkrInfo = loadData( rs );
                data.put( bkrInfo.getId(), bkrInfo );
            }

            if ( loadSession ) {
                rs.close();
                pstmt.close();
               
                Map sessionMap =
                    dbMgr.getDAOFactory().getStoreSessionDAO().getAllStoreSessions( conn );
                Iterator itr = sessionMap.entrySet().iterator();
                while ( itr.hasNext() ) {
                    Map.Entry entry = (Map.Entry)itr.next();
                    String brokerID = (String)entry.getKey();
                    HABrokerInfo bkrInfo = (HABrokerInfo)data.get( brokerID );
                    if ( bkrInfo != null ) {
                        bkrInfo.setSessionList( (List)entry.getValue() );
                    }
                }
            }
        } catch ( Exception e ) {
            myex = e;
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

            pstmt = conn.prepareStatement( selectAllByStateSQL );
            pstmt.setInt( 1, state.intValue() );
            rs = pstmt.executeQuery();
            while ( rs.next() ) {
                HABrokerInfo bkrInfo = loadData( rs );
                data.put( bkrInfo.getId(), bkrInfo );
            }
        } catch ( Exception e ) {
            myex = e;
            try {
                if ( (conn != null) && !conn.getAutoCommit() ) {
View Full Code Here

Examples of com.sun.messaging.jmq.jmsserver.persist.HABrokerInfo

     * Load the broker info to a value object.
     */
    protected HABrokerInfo loadData( ResultSet rs )
        throws SQLException {

        HABrokerInfo brokerInfo = new HABrokerInfo(
            rs.getString( ID_COLUMN ),
            rs.getString( TAKEOVER_BROKER_COLUMN ),
            rs.getString( URL_COLUMN ),
            rs.getInt( VERSION_COLUMN ),
            rs.getInt( STATE_COLUMN ),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.