Package com.sun.messaging.jmq.jmsserver.persist

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


     * @exception com.sun.messaging.jmq.jmsserver.util.BrokerException if the transaction id is not in the store
     */
    TransactionBroker[] getClusterTransactionBrokers(TransactionUID id)
  throws BrokerException {

        TransactionInfo txnInfo = (TransactionInfo)tidMap.get(id);

        if (txnInfo == null) {
            logger.log(Logger.ERROR,
                BrokerResources.E_TRANSACTIONID_NOT_FOUND_IN_STORE, id);
            throw new BrokerException(br.getString(
                BrokerResources.E_TRANSACTIONID_NOT_FOUND_IN_STORE, id),
                Status.NOT_FOUND);
        }

        TransactionBroker[] txnBrokers = txnInfo.getTransactionBrokers();
        if (txnBrokers != null) {
            // Make a copy
            txnBrokers = (TransactionBroker[])txnBrokers.clone();
        }

View Full Code Here


    HashMap getAllTransactionStates() throws IOException {
  HashMap map = new HashMap(tidMap.size());
        Iterator itr = tidMap.entrySet().iterator();
        while (itr.hasNext()) {
            Map.Entry entry = (Map.Entry)itr.next();
            TransactionInfo txnInfo = (TransactionInfo)entry.getValue();
            int type = txnInfo.getType();
            if (type == TransactionInfo.TXN_LOCAL ||
                type == TransactionInfo.TXN_CLUSTER) {
                map.put(entry.getKey(), (new TransactionInfo(txnInfo)));
            }
        }

        return map;
    }
View Full Code Here

    HashMap getAllRemoteTransactionStates() throws IOException {
  HashMap map = new HashMap(tidMap.size());
        Iterator itr = tidMap.entrySet().iterator();
        while (itr.hasNext()) {
            Map.Entry entry = (Map.Entry)itr.next();
            TransactionInfo txnInfo = (TransactionInfo)entry.getValue();
            int type = txnInfo.getType();
            if (type == TransactionInfo.TXN_REMOTE) {
                map.put(entry.getKey(), txnInfo.getTransactionState());
            }
        }

        return map;
    }
View Full Code Here

            // Check for those "orphaned" ack transactions here. We check
            // state here too just to be anal.
            itr = ackMap.keySet().iterator();
            while (itr.hasNext()) {
                TransactionUID tid = (TransactionUID)itr.next();
                TransactionInfo txnInfo = (TransactionInfo)tidMap.get(tid);
                if (txnInfo == null || txnInfo.getTransactionStateValue() != state) {
                    // Orphan. Remove from txnList
                    removeTransactionAck(tid);
                }
            }
        }
View Full Code Here

                    // Transaction table
                    Collection txnList = jdbcStore.getTransactions(brokerID);
                    Iterator txnItr = txnList.iterator();
                    while (txnItr.hasNext()) {
                        TransactionUID tid = (TransactionUID)txnItr.next();
                        TransactionInfo txnInfo = jdbcStore.getTransactionInfo(tid);
                        TransactionAcknowledgement txnAck[] =
                            jdbcStore.getTransactionAcks(tid);
                        bkrFS.storeTransaction(tid, txnInfo, false);
                        for (int i = 0, len = txnAck.length; i < len; i++) {
                            bkrFS.storeTransactionAck(tid, txnAck[i], false);
View Full Code Here

                    // Transaction table
                    Collection txnList = bkrFS.getTransactions(brokerID);
                    Iterator txnItr = txnList.iterator();
                    while (txnItr.hasNext()) {
                        TransactionUID tid = (TransactionUID)txnItr.next();
                        TransactionInfo txnInfo = bkrFS.getTransactionInfo(tid);
                        TransactionAcknowledgement txnAck[] =
                            bkrFS.getTransactionAcks(tid);
                        jdbcStore.storeTransaction(tid, txnInfo, sessionID);
                        for (int i = 0, len = txnAck.length; i < len; i++) {
                            jdbcStore.storeTransactionAck(tid, txnAck[i], false);
View Full Code Here

                    Map.Entry entry = (Map.Entry)itr.next();
                    Object key = entry.getKey();
                    Object value = entry.getValue();

                    // Replace TransactionState obj with TransactionInfo obj
                    tidMap.put(key, new TransactionInfo((TransactionState)value));
                }
            } else {
                loadClientData();
            }
  } catch (IOException e) {
View Full Code Here

      Map.Entry entry = (Map.Entry)itr.next();
      Object key = entry.getKey();
      Object value = entry.getValue();

            // replace TransactionState obj with TransactionInfo obj
      tidMap.put(key, new TransactionInfo((TransactionState)value));
  }
  olddata.close();

  if (Store.getDEBUG()) {
      logger.log(logger.DEBUG,
View Full Code Here

        try {
            // TransactionState is mutable, so we must store a copy
            // See bug 4989708
            Object oldValue = tidMap.putIfAbsent(
                id, new TransactionInfo(new TransactionState(ts)));

            if (oldValue != null) {
                logger.log(Logger.ERROR,
                    BrokerResources.E_TRANSACTIONID_EXISTS_IN_STORE, id);
                throw new BrokerException(br.getString(
View Full Code Here

     * @exception NullPointerException  if <code>id</code> is <code>null</code>
     */
    public void storeClusterTransaction(TransactionUID id, TransactionState ts,
        TransactionBroker[] brokers, boolean sync) throws BrokerException {

        TransactionInfo txnInfo = null;
        try {
            // TransactionState is mutable, so we must store a copy
            // See bug 4989708
            txnInfo = new TransactionInfo(new TransactionState(ts), null,
                brokers, TransactionInfo.TXN_CLUSTER);

            Object oldValue = tidMap.putIfAbsent(id, txnInfo);
            if (oldValue != null) {
                logger.log(Logger.ERROR,
                    BrokerResources.E_TRANSACTIONID_EXISTS_IN_STORE, id);
                throw new BrokerException(br.getString(
                    BrokerResources.E_TRANSACTIONID_EXISTS_IN_STORE, id));
            }

            if (sync) {
                sync(id);
            }
        } catch (RuntimeException e) {
            String msg = (txnInfo != null) ?
                id + " " + txnInfo.toString() : id.toString();
            logger.log(Logger.ERROR,
                BrokerResources.X_PERSIST_TRANSACTION_FAILED, msg, e);
            throw new BrokerException(br.getString(
                BrokerResources.X_PERSIST_TRANSACTION_FAILED, msg), e);
        }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.persist.TransactionInfo

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.