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

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


                                   Globals.getPacketRouter(0).getHandler(
                                          PacketType.ROLLBACK_TRANSACTION);
            TransactionUID[] tuids = (TransactionUID[])conlist.toArray(new TransactionUID[0]);
            for (int i = 0; i < tuids.length; i ++) {
                tid = (TransactionUID) tuids[i];
                TransactionState ts = Globals.getTransactionList().retrieveState(tid);
                if (ts == null) {
                    // nothing to do if no transaction state
                    continue;
                }
                int tstate = ts.getState();
                if (ts.getXid() != null) {
                    if (xaretainall) {
                        if (!xaretainallLogged) {
                        logger.log(Logger.INFO, Globals.getBrokerResources().getKString(
                                   BrokerResources.I_CONN_CLEANUP_RETAIN_XA));
                        xaretainallLogged = true;
                        }
                        continue;
                    }
                    if(tstate > TransactionState.COMPLETE) {
                       String[] args = { ""+tid+"(XID="+ts.getXid()+")",
                                         TransactionState.toString(tstate),
                                         getConnectionUID().toString() };
                        logger.log(Logger.INFO, Globals.getBrokerResources().getKString(
                                          BrokerResources.I_CONN_CLEANUP_KEEP_TXN, args));
                        continue;
                    }
                    if (tstate == TransactionState.INCOMPLETE ||
                        tstate == TransactionState.COMPLETE ) {
                        ts.detachedFromConnection();
                        timeoutTIDs.add(tid);
                        String[] args = { ""+tid+"(XID="+ts.getXid()+")",
                                          TransactionState.toString(tstate),
                                          getConnectionUID().toString() };
                        logger.log(Logger.INFO, Globals.getBrokerResources().getKString(
                                          BrokerResources.I_CONN_CLEANUP_KEEP_TXN, args));
                        continue;
                    }
                }
                if (tstate == TransactionState.PREPARED ||
                    tstate == TransactionState.COMMITTED ||
                    tstate == TransactionState.ROLLEDBACK) {
                    String[] args = { ""+tid,
                                      TransactionState.toString(tstate),
                                      getConnectionUID().toString() };
                    logger.log(Logger.INFO, Globals.getBrokerResources().getKString(
                               BrokerResources.I_CONN_CLEANUP_KEEP_TXN, args));
                    continue;
                }
                if (DEBUG || DEBUG_TXN) {
                    logger.log(Logger.INFO, "Cleanup connection ["+getConnectionUID()+
                    "]: cleaning up transaction "+tid+"["+TransactionState.toString(tstate)+"]");
                }
                try {
                     rollbackHandler.doRollback(tid, ts.getXid(), null, ts, conlist,
                                   null, RollbackReason.CONNECTION_CLEANUP);
                } catch (Exception e) {
                     String[] args = { ""+tid+"["+TransactionState.toString(tstate)+"]",
                                       getConnectionUID().toString(), e.getMessage() };
                     logger.logStack(logger.WARNING,
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

        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,
View Full Code Here

                removedAcksFlag = true;
            }

            // Now we store the txn;
            // TransactionState is mutable, so we must store a copy
            txnInfo = new TransactionInfo(new TransactionState(ts), txnHomeBroker,
                    null, TransactionInfo.TXN_REMOTE);
            tidMap.put(id, txnInfo);
        } catch (RuntimeException e) {
            String msg = (txnInfo != null) ?
                id + " " + txnInfo.toString() : id.toString();
View Full Code Here

                throw new BrokerException(
                    br.getString(BrokerResources.E_TRANSACTIONID_NOT_FOUND_IN_STORE, id),
                    Status.NOT_FOUND);
            }

            TransactionState txnState = txnInfo.getTransactionState();
            if (txnState.getState() != ts) {
                txnState.setState(ts);

                tidMap.put(id, txnInfo);
            }
        } catch (Exception e) {
            logger.log(Logger.ERROR, BrokerResources.X_UPDATE_TXNSTATE_FAILED, id, e);
View Full Code Here

                throw new BrokerException(br.getString(
                    BrokerResources.E_TRANSACTIONID_NOT_FOUND_IN_STORE, id),
                    Status.NOT_FOUND);
            }

            TransactionState txnState = txnInfo.getTransactionState();
            if (txnState.getState() != expectedTxnState) {
                Object[] args = { txnBkr, id,
                    TransactionState.toString(expectedTxnState),
                    TransactionState.toString(txnState.getState()) };
                throw new BrokerException(br.getKString( BrokerResources.E_UPDATE_TXNBROKER_FAILED,
                    args ), Status.CONFLICT);
            }

            txnInfo.updateBrokerState(txnBkr);
View Full Code Here

            throw new BrokerException(br.getString(
                BrokerResources.E_TRANSACTIONID_NOT_FOUND_IN_STORE, id),
                Status.NOT_FOUND);
        }

        return new TransactionState(txnInfo.getTransactionState());
    }
View Full Code Here

    int getTransactionStateValue(TransactionUID id)
        throws BrokerException {

        TransactionInfo txnInfo = (TransactionInfo)tidMap.get(id);
        if (txnInfo != null) {
            TransactionState txnState = txnInfo.getTransactionState();
            if (txnState != null) {
                return txnState.getState();
            }
        }

        return TransactionState.NULL;
    }   
View Full Code Here

        Iterator itr = tidMap.entrySet().iterator();
        while (itr.hasNext()) {
            try {
                Map.Entry entry = (Map.Entry)itr.next();
                TransactionUID tid = (TransactionUID)entry.getKey();
                TransactionState ts = (TransactionState)entry.getValue();
                // Remove if not in prepared state
                if (ts.getState() != state) {
                    itr.remove();
                    removeTransactionAck(tid);
                }
            } catch (RuntimeException e) {
                error = true;
View Full Code Here

                    dbuf.append("\n\t"+tas[i]);
                    }
                }
                if (ae != null) throw ae;

                TransactionState ts = new TransactionState();
                ts.setState(TransactionState.PREPARED);
                if (DEBUG_CLUSTER_TXN) {
                logger.log(logger.INFO, "Preparing remote transaction "+tid + " from "+txnHomeBroker+dbuf.toString());
                }
                Globals.getTransactionList().logRemoteTransaction(tid, ts, tas,
                                       txnHomeBroker, false, true, true);
View Full Code Here

TOP

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

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.