Package bitronix.tm

Examples of bitronix.tm.BitronixXid


                if (log.isDebugEnabled()) log.debug("skipping non-bitronix XID " + xid + "(format ID: " + xid.getFormatId() +
                     " GTRID: " + new Uid(xid.getGlobalTransactionId()) + "BQUAL: " + new Uid(xid.getBranchQualifier()) + ")");
                continue;
             }

            BitronixXid bitronixXid = new BitronixXid(xid);

            if (currentNodeOnly) {
                if (log.isDebugEnabled()) log.debug("recovering XIDs generated by this node only - recovered XIDs' GTRID must contain this JVM uniqueId");
                byte[] extractedServerId = bitronixXid.getGlobalTransactionIdUid().extractServerId();
                byte[] jvmUniqueId = TransactionManagerServices.getConfiguration().buildServerIdArray();

                if (extractedServerId == null) {
                    log.error("skipping XID " + bitronixXid + " as its GTRID's serverId is null. It looks like the disk journal is corrupted!");
                    continue;
View Full Code Here


            int commitCount = 0;
            int rollbackCount = 0;
            Iterator it = xids.iterator();
            while (it.hasNext()) {
                BitronixXid xid = (BitronixXid) it.next();
                Uid gtrid = xid.getGlobalTransactionIdUid();

                TransactionLogRecord tlog = (TransactionLogRecord) danglingRecords.get(gtrid);
                if (tlog != null) {
                    if (log.isDebugEnabled()) log.debug("committing " + xid);
                    success &= RecoveryHelper.commit(xaResourceHolderState, xid);
                    updateJournal(xid.getGlobalTransactionIdUid(), uniqueName, Status.STATUS_COMMITTED);
                    commitCount++;
                }
                else {
                    if (log.isDebugEnabled()) log.debug("rolling back " + xid);
                    success &= RecoveryHelper.rollback(xaResourceHolderState, xid);
                    updateJournal(xid.getGlobalTransactionIdUid(), uniqueName, Status.STATUS_ROLLEDBACK);
                    rollbackCount++;
                }
            }

            // if recovery isn't successful we don't mark the resource as failed: heuristics might have happened
View Full Code Here

                continue;
            }

            Iterator it2 = recoveredXids.iterator();
            while (it2.hasNext()) {
                BitronixXid recoveredXid = (BitronixXid) it2.next();
                if (gtrid.equals(recoveredXid.getGlobalTransactionIdUid())) {
                    if (log.isDebugEnabled()) log.debug("found a recovered XID matching dangling log's GTRID " + gtrid + " in resource " + uniqueName);
                    danglingTransactions.add(new DanglingTransaction(uniqueName, recoveredXid));
                }
            } // while it2.hasNext()
        }
View Full Code Here

     */
    private int rollbackAbortedBranchesOfResource(long oldestTransactionTimestamp, String uniqueName, Set recoveredXids, Set committedGtrids) throws RecoveryException {
        int abortedCount = 0;
        Iterator it = recoveredXids.iterator();
        while (it.hasNext()) {
            BitronixXid recoveredXid = (BitronixXid) it.next();
            if (committedGtrids.contains(recoveredXid.getGlobalTransactionIdUid())) {
                if (log.isDebugEnabled()) log.debug("XID has been committed, skipping rollback: " + recoveredXid + " on " + uniqueName);
                continue;
            }

            long txTimestamp = recoveredXid.getGlobalTransactionIdUid().extractTimestamp();
            if (log.isDebugEnabled()) log.debug("recovered XID timestamp: " + txTimestamp + " - oldest in-flight TX timestamp: " + oldestTransactionTimestamp);
            if (txTimestamp >= oldestTransactionTimestamp) {
                if (log.isDebugEnabled()) log.debug("skipping XID of in-flight transaction: " + recoveredXid);
                continue;
            }
View Full Code Here

        // iteration order is guraranteed so just take the latest matching one in the iterator
        while (statesForGtridIt.hasNext()) {
            XAResourceHolderState xaResourceHolderState = (XAResourceHolderState) statesForGtridIt.next();

            if (xaResourceHolderState != null && xaResourceHolderState.getXid() != null) {
                BitronixXid bitronixXid = xaResourceHolderState.getXid();
                Uid resourceGtrid = bitronixXid.getGlobalTransactionIdUid();
                Uid currentTransactionGtrid = currentTransaction.getResourceManager().getGtrid();

                if (currentTransactionGtrid.equals(resourceGtrid)) {
                    result = xaResourceHolderState;
                }
View Full Code Here

        if (alreadyEnlistedHolder != null) {
            if (log.isDebugEnabled()) log.debug("resource already enlisted but has been ended eligible for join: " + alreadyEnlistedHolder);
            toBeJoinedHolderState = getManagedResourceWithSameRM(xaResourceHolderState);
        }

        BitronixXid xid;
        int flag;

        if (toBeJoinedHolderState != null) {
            if (log.isDebugEnabled()) log.debug("joining " + xaResourceHolderState + " with " + toBeJoinedHolderState);
            xid = toBeJoinedHolderState.getXid();
View Full Code Here

     * Generate a XID with the specified globalTransactionId.
     * @param gtrid the GTRID to use to generate the Xid.
     * @return the generated Xid.
     */
    public static BitronixXid generateXid(Uid gtrid) {
        return new BitronixXid(gtrid, generateUid());
    }
View Full Code Here

        class LocalVisitor implements XAResourceHolderStateVisitor {
            private boolean found;
            public boolean visit(XAResourceHolderState xaResourceHolderState) {
                // compare GTRIDs
                BitronixXid bitronixXid = xaResourceHolderState.getXid();
                Uid resourceGtrid = bitronixXid.getGlobalTransactionIdUid();
                if (log.isDebugEnabled()) { log.debug("NOT_ACCESSIBLE xa resource GTRID: " + resourceGtrid); }
                if (currentTxGtrid.equals(resourceGtrid)) {
                    if (log.isDebugEnabled()) { log.debug("NOT_ACCESSIBLE xa resource's GTRID matched this transaction's GTRID, recycling it"); }
                    found = true;
                }
View Full Code Here

        class LocalVisitor implements XAResourceHolderStateVisitor {
            private boolean found;
            public boolean visit(XAResourceHolderState xaResourceHolderState) {
                // compare GTRIDs
                BitronixXid bitronixXid = xaResourceHolderState.getXid();
                Uid resourceGtrid = bitronixXid.getGlobalTransactionIdUid();
                if (log.isDebugEnabled()) { log.debug("NOT_ACCESSIBLE xa resource GTRID: " + resourceGtrid); }
                if (currentTxGtrid.equals(resourceGtrid)) {
                    if (log.isDebugEnabled()) { log.debug("NOT_ACCESSIBLE xa resource's GTRID matched this transaction's GTRID, recycling it"); }
                    found = true;
                }
View Full Code Here

        class LocalVisitor implements XAResourceHolderStateVisitor {
            private XAResourceHolderState latestEnlistedHolder;
            public boolean visit(XAResourceHolderState xaResourceHolderState) {
                if (xaResourceHolderState != null && xaResourceHolderState.getXid() != null) {
                    BitronixXid bitronixXid = xaResourceHolderState.getXid();
                    Uid resourceGtrid = bitronixXid.getGlobalTransactionIdUid();
                    Uid currentTransactionGtrid = currentTransaction.getResourceManager().getGtrid();

                    if (currentTransactionGtrid.equals(resourceGtrid)) {
                        latestEnlistedHolder = xaResourceHolderState;
                    }
View Full Code Here

TOP

Related Classes of bitronix.tm.BitronixXid

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.