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

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


      } catch (Exception e)  {
          throw new Exception("Invalid transaction ID: " + transactionID);
      }

      TransactionUID tid = new TransactionUID(longTid);
      TransactionList tl = Globals.getTransactionList();
      TransactionState ts;

      if (tl == null)  {
          throw new Exception("Null transaction list");
      }

      ts = tl.retrieveState(tid);

      if (ts == null)  {
          throw new Exception(rb.getString(rb.E_NO_SUCH_TRANSACTION, tid));
      }

      if (ts.getState() != TransactionState.PREPARED)  {
          throw new Exception(rb.getString(rb.E_TRANSACTION_NOT_PREPARED, tid));
      }

      JMQXid xid = tl.UIDToXid(tid);

      if (xid == null) {
          throw new Exception(rb.getString(rb.E_INTERNAL_BROKER_ERROR,
        "Could not find Xid for " + tid));
      }
View Full Code Here


        synchronized(destMessages) {
        msgs = new HashSet(destMessages.values());
        }
        Iterator itr = msgs.iterator();
        int cnt = 0;
        TransactionList tl = Globals.getTransactionList();
        while (itr.hasNext()) {
            PacketReference ref = (PacketReference)itr.next();
            TransactionUID tid = ref.getTransactionID();
            if (tid == null) continue;
            if (tl.retrieveState(tid) == null) continue;
            cnt ++;
        }
        return cnt;
    }
View Full Code Here

        synchronized(destMessages) {
        msgs = new HashSet(destMessages.values());
        }
        Iterator itr = msgs.iterator();
        long size = 0;
        TransactionList tl = Globals.getTransactionList();
        while (itr.hasNext()) {
            PacketReference ref = (PacketReference)itr.next();
            TransactionUID tid = ref.getTransactionID();
            if (tid == null) continue;
            if (tl.retrieveState(tid) == null) continue;
            size += ref.getSize();
        }
        return size;
    }
View Full Code Here

                             + pr.getSysMessageID() + " has "
                             + consumerList.size() + " consumers ");
                        ConsumerUID cuid = (ConsumerUID)citr.next();
                        String key = pr.getSysMessageID() +
                                    ":" + cuid;
                        TransactionList tl = Globals.getTransactionList();
                        TransactionUID tid = (TransactionUID) ackLookup.get(key);
                        if (DEBUG) {
                        logger.log(logger.INFO, "loadTakeoverMsgs: lookup "+key+" found tid="+tid);
                        }
                        if (tid != null) {
                            boolean remote = false;
                            TransactionState ts = tl.retrieveState(tid);
                            if (ts == null) {
                                ts = tl.getRemoteTransactionState(tid);
                                remote = true;
                            }
                            if (DEBUG) {
                            logger.log(logger.INFO, "tid="+tid+" has state="+
                                       TransactionState.toString(ts.getState()));
                            }
                            if (ts != null &&
                                ts.getState() != TransactionState.ROLLEDBACK &&
                                ts.getState() != TransactionState.COMMITTED) {
                                // in transaction ...
                                if (DEBUG) {
                                    logger.log(Logger.INFO,
                                    "loadTakeoverMsgs: Open transaction ack ["+key +"]"+
                                     (remote?"remote":"")+", TUID="+tid);
                                }
                                if (!remote) {
                                    try {
                                    tl.addAcknowledgement(tid, pr.getSysMessageID(),
                                                          cuid, cuid, true, false);
                                    } catch (TransactionAckExistException e) {

                                    //can happen if takeover tid's remote txn after restart
                                    //then txn ack would have already been loaded
                                    logger.log(Logger.INFO,
                                               Globals.getBrokerResources().getKString(
                                               BrokerResources.I_TAKINGOVER_TXN_ACK_ALREADY_EXIST,
                                                       "["+pr.getSysMessageID()+"]"+cuid+":"+cuid,
                                                       tid+"["+TransactionState.toString(ts.getState())+"]"));

                                    }
                                    tl.addOrphanAck(tid, pr.getSysMessageID(), cuid);

                                }
                                citr.remove();
                                logger.log(Logger.INFO,"Processing open ack " +
                                      pr.getSysMessageID() + ":" + cuid + " on " + tid);
View Full Code Here

          TransactionUID id = null;
          if (xaFlags == null ||
              TransactionState.isFlagSet(XAResource.TMNOFLAGS, xaFlags)) {
              id = new TransactionUID();
          } else if (xid != null) {
              TransactionList translist = handler.getTransactionList();

              id = translist.xidToUID(xid);
         
          } else { // XID is null, something is wrong
              throw new BrokerException("Invalid xid");
          }
         
View Full Code Here

         }

         TransactionHandler handler = (TransactionHandler)
                      pr.getHandler(PacketType.START_TRANSACTION);

         TransactionList translist = handler.getTransactionList();
         Vector v = null;
         if (id == null) {
             v = translist.getTransactions(TransactionState.PREPARED);
        
         } else { // look at a single transaction
             v = new Vector();
             TransactionState ts = translist.retrieveState(id);
             if (ts.getState() == TransactionState.PREPARED) {
                 v.add(id);
             }
         }

         JMQXid xids[] = new JMQXid[v.size()];
         Iterator itr = v.iterator();
         int i = 0;
         while (itr.hasNext()) {
             TransactionUID tuid = (TransactionUID)itr.next();
             TransactionState _ts = translist.retrieveState(tuid);
             if (_ts == null) {
                 // Should never happen
                 continue;
             }
             JMQXid _xid = _ts.getXid();
View Full Code Here

     public Map verifyTransaction(TransactionUID tuid)
         throws BrokerException
     {
         TransactionHandler handler = (TransactionHandler)
                      pr.getHandler(PacketType.START_TRANSACTION);
         TransactionList translist = handler.getTransactionList();
         TransactionState ts = translist.retrieveState(tuid, true);
         if (ts == null) return null; // GONE
         int realstate = ts.getState();

         if (realstate != TransactionState.PREPARED) {
             return null; // GONE
         }
         return  translist.getTransactionMap(tuid, true);
     }
View Full Code Here

        // sort the messages
        ArrayList sorted = new ArrayList(msgs);
        Collections.sort(sorted, new RefCompare());  

        TransactionList tlist = Globals.getTransactionList();

        // remove any expired messages or messages in open txn
        Iterator itr = sorted.iterator();
        while (itr.hasNext()) {
            PacketReference p = (PacketReference)itr.next();
            if (p.isExpired())
                itr.remove();
            if (p.getTransactionID() != null) {
                // look up txn
                TransactionState ts = tlist.retrieveState(p.getTransactionID());
                if (ts != null && ts.getState() != TransactionState.COMMITTED) {
                    // open txn, remove
                    itr.remove();
                }
            }
View Full Code Here

        }
    }


    private void sendTransactionInquiries(BrokerAddress broker) {
        TransactionList translist = Globals.getTransactionList();
        ArrayList tids = translist.getPreparedRemoteTransactions();
        TransactionUID tid = null;
        Iterator itr = tids.iterator();
        ClusterTxnInquiryInfo cii = null;
        TransactionBroker txnhome = null;
        while ( itr.hasNext()) {
            tid = (TransactionUID)itr.next();
            txnhome = translist.getRemoteTransactionHomeBroker(tid);
            cii = ClusterTxnInquiryInfo.newInstance(Long.valueOf(tid.longValue()),
                              ((txnhome == null) ? null:txnhome.getBrokerAddress()), null);
            if (DEBUG_CLUSTER_TXN) {
            logger.log(Logger.INFO, "Sending transaction inquiry: " + cii + " to "+broker);
View Full Code Here

        TransactionBroker thb = null;
        if (txnHomeBroker != null) {
            thb = new TransactionBroker(txnHomeBroker);
        }

        TransactionList translist = Globals.getTransactionList();
        TransactionState ts =  translist.retrieveState(tid, true);
        if (ts == null && DEBUG_CLUSTER_TXN) {
            logger.log(logger.INFO, "Transaction "+ tid+ " not found in local transaction");
        }
        if (ts != null) {
            BrokerAddress currba = (thb == null ? null:thb.getCurrentBrokerAddress());
View Full Code Here

TOP

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

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.