Package com.sun.messaging.jmq.jmsserver.data

Examples of com.sun.messaging.jmq.jmsserver.data.TransactionBroker


  ConnectionUID cuid = ts.getConnectionUID();
  if (cuid != null)  {
      table.put("connectionid", new Long(cuid.longValue()));
  }

  TransactionBroker homeBroker = tl.getRemoteTransactionHomeBroker(id);
  String homeBrokerStr = "";
  if (homeBroker != null)  {
      homeBrokerStr = homeBroker.getBrokerAddress().toString();
  }
        table.put("homebroker", homeBrokerStr);

      TransactionBroker brokers[] = null;

        if (type != REMOTE) {
            try {
                brokers = tl.getClusterTransactionBrokers(id);
            } catch (BrokerException be)  {
                logger.log(Logger.WARNING,
                "Exception caught while obtaining list of brokers in transaction", be);
            }
        }

      String allBrokers = "", pendingBrokers = "";

      if (brokers != null)  {
    for  (int i = 0; i < brokers.length; ++i)  {
              TransactionBroker oneBroker = brokers[i];
       
        BrokerAddress addr = oneBroker.getBrokerAddress();

        if (allBrokers.length() != 0)  {
            allBrokers += ", ";
        }
        allBrokers += addr.toString();

        if (oneBroker.isCompleted())  {
      continue;
        }

        if (pendingBrokers.length() != 0)  {
            pendingBrokers += ", ";
View Full Code Here


                 buf.append("\n\t"+tbas[i]);
            }
            logger.log(logger.INFO, buf.toString());
        }
        ArrayList[] mcll = null;
        TransactionBroker ba = null;
        for (int i = 0; i < tbas.length; i++) {
            ba = tbas[i];
            if (ba.getBrokerAddress() == Globals.getMyAddress()) continue;
            mcll = (ArrayList[]) bmmap.get(ba);
            try {

            Globals.getClusterBroadcast().acknowledgeMessage2P(ba.getBrokerAddress(),
                                (SysMessageID[])mcll[0].toArray(new SysMessageID[0]),
                                (ConsumerUID[])mcll[1].toArray(new ConsumerUID[0]),
                                ClusterBroadcast.MSG_PREPARE, null, new Long(id.longValue()), true, false);
            } catch (BrokerException e) {
            if (!(e instanceof BrokerDownException) &&
View Full Code Here

            if (ba == null) ba = Globals.getMyAddress();
            if (ba != Globals.getMyAddress() && !hasRemote) {
                hasRemote = true;
                if (checkOnly) return new HashMap();
            }
            TransactionBroker tba = new TransactionBroker(ba);
            mcll = (ArrayList[])bmmap.get(tba);
            if (mcll == null) {
                mcll = new ArrayList[2];
                mcll[0] new ArrayList();
                mcll[1] new ArrayList();
View Full Code Here

        TransactionState ts = translist.getRemoteTransactionState(tid);
        if (ts == null || ts.getState() != TransactionState.ROLLEDBACK) {
            throw new BrokerException(Globals.getBrokerResources().E_INTERNAL_BROKER_ERROR,
            "Unexpected broker state "+ts+ " for processing Rolledback remote transaction "+tid);
        }
        TransactionBroker ba = translist.getRemoteTransactionHomeBroker(tid);
        BrokerAddress currba = (ba == null) ? null: ba.getCurrentBrokerAddress();
        if (currba == null || !currba.equals(from)) {
            logger.log(logger.WARNING, "Rolledback remote transaction "+tid+" home broker "+ba+ " not "+from);
        }
        RemoteTransactionAckEntry[] tae = translist.getRecoveryRemoteTransactionAcks(tid);
        if (tae == null) {
View Full Code Here

                 com.sun.messaging.jmq.jmsserver.core.BrokerAddress from)
                 throws BrokerException {
        logger.log(logger.INFO,"Committing recovery remote transaction " + tid + " from "+from);

        TransactionList translist = Globals.getTransactionList();
        TransactionBroker ba = translist.getRemoteTransactionHomeBroker(tid);
        BrokerAddress currba = (ba == null) ? null: ba.getCurrentBrokerAddress();
        if (currba == null || !currba.equals(from)) {
            logger.log(logger.WARNING, "Committed remote transaction "+tid+" home broker "+ba+ " not "+from);
        }
        RemoteTransactionAckEntry[] tae = translist.getRecoveryRemoteTransactionAcks(tid);
        if (tae == null) {
View Full Code Here

  }

  boolean updateTransactionBrokerState(TransactionBroker txnBkr,
      ClusterTransaction clusterTxn) {
    TransactionBroker[] txnBrokers = clusterTxn.getTransactionBrokers();
    TransactionBroker result = null;

    BrokerAddress b = txnBkr.getBrokerAddress();
    boolean allComplete = true;
    for (int i = 0; i < txnBrokers.length; i++) {
      BrokerAddress ba = txnBrokers[i].getCurrentBrokerAddress();
      if (ba == null)
        continue;
      if (ba.equals(b))
        result = txnBrokers[i];
      else {
        allComplete &= txnBrokers[i].isCompleted();
      }
    }

    result.setCompleted(true);
    return allComplete;
  }
View Full Code Here

            // TransactionBroker is mutable, so we must store a copy
            int size = bkrs.length;
            txnBkrs = new TransactionBroker[size];
            StringBuffer debugBuf = null;
            for (int i = 0; i < size; i++) {
                TransactionBroker txnBkr = (TransactionBroker)bkrs[i].clone();
                txnBkrs[i] = txnBkr;
                if (DEBUG) {
                    if (debugBuf == null) debugBuf = new StringBuffer();
                    if (i > 0) debugBuf.append(",");
                    debugBuf.append(txnBkr);
                }

                // Create a lookup map (BrokerAddress -> TransactionBroker)
                bkrMap.put(txnBkr.getBrokerAddress(), txnBkr);
            }

            // Verify that there are no duplicate
            if (bkrMap.size() != size) {
                String emsg = "Unexpected Error: duplicate TransactionBroker object found "+
View Full Code Here

    }

    public void updateBrokerState(TransactionBroker bkr)
        throws BrokerException {

        TransactionBroker txnBkr =
            (TransactionBroker)bkrMap.get(bkr.getBrokerAddress());
        if (txnBkr == null) {
            throw new BrokerException("TransactionBroker " + txnBkr +
                " could not be found in the store", Status.NOT_FOUND);
        }

        // Just update the state
        txnBkr.copyState(bkr);
    }
View Full Code Here

       
        // populate bkrMap
        // fix for CR 6858156
        if (txnBkrs != null) {
      for (int i = 0; i < txnBkrs.length; i++) {
        TransactionBroker txnBkr = txnBkrs[i];
        bkrMap.put(txnBkr.getBrokerAddress(), txnBkr);
      }
      // Verify that there are no duplicate
      if (bkrMap.size() != txnBkrs.length) {
        Globals.getLogger().log(Logger.WARNING,
            "Internal Error: duplicate TransactionBroker object found");
View Full Code Here

                    // Now read in modified txn broker states
                    TransactionBroker[] bkrs = value.getTransactionBrokers();
                    if (bkrs != null) {
                        for (int i = 0, len = bkrs.length; i < len; i++) {
                            TransactionBroker bkr = bkrs[i];

                            // update bkr's state
                            boolean isComplete = ((int)cData[i+1] == 1); // 1 == true
                            bkr.setCompleted(isComplete);
                        }
                    }
                }
            } catch (Throwable e) {
                ex = e;
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.data.TransactionBroker

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.