Examples of Xid


Examples of javax.transaction.xa.Xid

            throw new IllegalStateException();
        }

        // Preventing two branches from being active at the same time on the
        // same resource manager
        Xid activeXid = activeBranches.get(xaRes);
        if (activeXid != null)
        {
            return false;
        }

        boolean alreadyEnlisted = false;
        int flag = XAResource.TMNOFLAGS;

        Xid branchXid = suspendedResources.get(xaRes);
        if (branchXid == null)
        {
            Iterator<XAResource> enlistedIterator = enlistedResources.iterator();
            while ((!alreadyEnlisted) && (enlistedIterator.hasNext()))
            {
View Full Code Here

Examples of javax.transaction.xa.Xid

            List failures = null;
            Iterator branchKeys = branches.keySet().iterator();
            status = Status.STATUS_ROLLING_BACK;
            while (branchKeys.hasNext())
            {
                Xid xid = (Xid) branchKeys.next();
                XAResource resourceManager = branches.get(xid);
                try
                {
                    resourceManager.rollback(xid);
                }
View Full Code Here

Examples of javax.transaction.xa.Xid

                PreparedStatement ps = connection.prepareStatement(RECOVER);
                try {
                    ps.setString(0, systemId);
                    ResultSet rs = ps.executeQuery();
                    try {
                        Xid lastXid = null;
                        Xid currentXid = null;
                        Recovery.XidBranchesPair xidBranchesPair = null;
                        while (rs.next()) {
                            int formatId = rs.getInt(0);
                            byte[] globalId = rs.getBytes(1);
                            byte[] globalBranchId = rs.getBytes(2);
                            byte[] branchBranchId = rs.getBytes(3);
                            String name = rs.getString(4);
                            currentXid = xidFactory.recover(formatId, globalId, globalBranchId);
                            Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId);
                            if (!currentXid.equals(lastXid)) {
                                xidBranchesPair = new Recovery.XidBranchesPair(currentXid, null);
                                recovered.add(xidBranchesPair);
                                lastXid = currentXid;
                            }
View Full Code Here

Examples of javax.transaction.xa.Xid

    //Build the SYNNCTL commit command
    public void writeLocalXACommit(NetConnection conn) throws SqlException {
        NetXACallInfo callInfo =
                conn.xares_.callInfoArray_[conn.currXACallInfoOffset_];
        Xid xid = callInfo.xid_;
        buildSYNCCTLMigrate();   // xa migrate to resync server
        buildSYNCCTLCommit(CodePoint.TMLOCAL, xid);   // xa local commit
    }
View Full Code Here

Examples of javax.transaction.xa.Xid

        buildSYNCCTLRollback(CodePoint.TMLOCAL);   // xa local rollback
    }

    public void writeXaStartUnitOfWork(NetConnection conn) throws SqlException {
        NetXACallInfo callInfo = conn.xares_.callInfoArray_[conn.currXACallInfoOffset_];
        Xid xid = callInfo.xid_;
        int xaFlags = callInfo.xaFlags_;
        long xaTimeout = callInfo.xaTimeoutMillis_;

        // create DSS command with reply.
        createCommand();

        // save the length bytes for later update
        markLengthBytes(CodePoint.SYNCCTL);

        // SYNCTYPE
        writeSYNCType(CodePoint.SYNCTYPE, CodePoint.SYNCTYPE_NEW_UOW);

        if (xid.getFormatId() != -1) {
            writeXID(CodePoint.XID, xid);
        } else
        // write the null XID for local transaction on XA connection
        {
            writeNullXID(CodePoint.XID);
View Full Code Here

Examples of javax.transaction.xa.Xid

        updateLengthBytes();
    }

    public void writeXaEndUnitOfWork(NetConnection conn) throws SqlException {
        NetXACallInfo callInfo = conn.xares_.callInfoArray_[conn.currXACallInfoOffset_];
        Xid xid = callInfo.xid_;
        int xaFlags = callInfo.xaFlags_;

        createCommand();

        // save the length bytes for later update
        markLengthBytes(CodePoint.SYNCCTL);

        // SYNCTYPE
        writeSYNCType(CodePoint.SYNCTYPE, CodePoint.SYNCTYPE_END_UOW);

        if (xid.getFormatId() != -1) {
            writeXID(CodePoint.XID, xid);
        } else
        // write the null XID for local transaction on XA connection
        {
            writeNullXID(CodePoint.XID);
View Full Code Here

Examples of javax.transaction.xa.Xid

        updateLengthBytes();
    }

    protected void writeXaPrepare(NetConnection conn) throws SqlException {
        NetXACallInfo callInfo = conn.xares_.callInfoArray_[conn.currXACallInfoOffset_];
        Xid xid = callInfo.xid_;
        // don't forget that xars.prepare() does not have flags, assume TMNOFLAGS
        int xaFlags = XAResource.TMNOFLAGS;

        createCommand();

        // save the length bytes for later update
        markLengthBytes(CodePoint.SYNCCTL);

        // SYNCTYPE
        writeSYNCType(CodePoint.SYNCTYPE, CodePoint.SYNCTYPE_PREPARE);

        if (xid.getFormatId() != -1) {
            writeXID(CodePoint.XID, xid);
        } else
        // write the null XID for local transaction on XA connection
        {
            writeNullXID(CodePoint.XID);
View Full Code Here

Examples of javax.transaction.xa.Xid

    protected void setUp() throws Exception {
        tm = new TransactionManagerImpl(10 * 1000, null, null);
    }

    public void testImportXid() throws Exception {
        Xid externalXid = xidFactory.createXid();
        Transaction tx = tm.importXid(externalXid, 0);
        assertNotNull(tx);
        assertEquals(Status.STATUS_ACTIVE, tx.getStatus());
    }
View Full Code Here

Examples of javax.transaction.xa.Xid

        assertNotNull(tx);
        assertEquals(Status.STATUS_ACTIVE, tx.getStatus());
    }

    public void testNoResourcesCommitOnePhase() throws Exception {
        Xid externalXid = xidFactory.createXid();
        Transaction tx = tm.importXid(externalXid, 0);
        tm.commit(tx, true);
        assertEquals(Status.STATUS_NO_TRANSACTION, tx.getStatus());
    }
View Full Code Here

Examples of org.apache.qpid.server.store.Xid

    protected DatabaseEntry getXidKey()
    {
        final DatabaseEntry value = new DatabaseEntry();
        byte[] globalId = { 1 };
        byte[] branchId = { 2 };
        Xid xid = new Xid(1l, globalId, branchId);
        XidBinding xidBinding = XidBinding.getInstance();
        xidBinding.objectToEntry(xid, value);
        return value;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.