Package javax.transaction.xa

Examples of javax.transaction.xa.Xid


    private void testRollbackWithoutPrepare() throws Exception {
        if (config.memory) {
            return;
        }
        Xid xid = new Xid() {
            public int getFormatId() {
                return 3145;
            }
            public byte[] getGlobalTransactionId() {
                return new byte[] { 1, 2, 3, 4, 5, 6, 6, 7, 8 };
View Full Code Here


                stat1.executeUpdate("INSERT INTO xatest VALUES (1, 0)");
                trace("stmt2.executeUpdate(\"INSERT INTO xatest VALUES (2, 0)\")");
                stat2.executeUpdate("INSERT INTO xatest VALUES (2, 0)");
            }

            Xid xid1 = null;
            Xid xid2 = null;

            if (useOneDatabase) {
                xid1 = SimpleXid.createRandom();
                xid2 = SimpleXid.createRandom();
            } else {
View Full Code Here

        return formatId;
    }

    public boolean equals(Object other) {
        if (other instanceof Xid) {
            Xid xid = (Xid) other;
            if (xid.getFormatId() == formatId) {
                if (Utils.compareNotNull(branchQualifier, xid.getBranchQualifier()) == 0) {
                    if (Utils.compareNotNull(globalTransactionId, xid.getGlobalTransactionId()) == 0) {
                        return true;
                    }
                }
            }
        }
View Full Code Here

        Connection conn;

        conn = xa.getConnection();
        Statement stat = conn.createStatement();
        stat.execute("create table test(id int primary key, name varchar(255))");
        Xid xid = SimpleXid.createRandom();
        xa.getXAResource().start(xid, XAResource.TMNOFLAGS);
        conn.setAutoCommit(false);
        stat.execute("insert into test values(1, 'Hello')");
        xa.getXAResource().end(xid, XAResource.TMSUCCESS);
        xa.getXAResource().prepare(xid);
        if (shutdown) {
            shutdown(ds);
        }

        xa = ds.getXAConnection();
        Xid[] list = xa.getXAResource().recover(XAResource.TMSTARTRSCAN);
        assertEquals(1, list.length);
        assertTrue(xid.equals(list[0]));
        if (commit) {
            xa.getXAResource().commit(list[0], false);
        } else {
            xa.getXAResource().rollback(list[0]);
        }
View Full Code Here

            ResultSet rs = stat.executeQuery("SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT ORDER BY TRANSACTION");
            ArrayList<Xid> list = New.arrayList();
            while (rs.next()) {
                String tid = rs.getString("TRANSACTION");
                int id = getNextId(XID);
                Xid xid = new JdbcXid(factory, id, tid);
                list.add(xid);
            }
            rs.close();
            Xid[] result = new Xid[list.size()];
            list.toArray(result);
View Full Code Here

        
         XASession sess2 = conn2.createXASession();
        
         XAResource res = sess2.getXAResource();
        
         Xid xid1 = new MessagingXid("bq1".getBytes(), 42, "eemeli".getBytes());
        
         res.start(xid1, XAResource.TMNOFLAGS);
        
         MessageProducer prod3 = sess2.createProducer(queueA);
        
View Full Code Here

        
         XASession sess2 = conn2.createXASession();
        
         XAResource res = sess2.getXAResource();
        
         Xid xid1 = new MessagingXid("bq1".getBytes(), 42, "eemeli".getBytes());
        
         res.start(xid1, XAResource.TMNOFLAGS);
        
         MessageProducer prod3 = sess2.createProducer(queueA);
        
View Full Code Here

        
         XASession sess2 = conn2.createXASession();
        
         XAResource res = sess2.getXAResource();
        
         Xid xid1 = new MessagingXid("bq1".getBytes(), 42, "eemeli".getBytes());
        
         res.start(xid1, XAResource.TMNOFLAGS);
        
         MessageProducer prod3 = sess2.createProducer(queueA);
        
View Full Code Here

        
         XASession sess2 = conn2.createXASession();
        
         XAResource res = sess2.getXAResource();
        
         Xid xid1 = new MessagingXid("bq1".getBytes(), 42, "eemeli".getBytes());
        
         res.start(xid1, XAResource.TMNOFLAGS);
        
         MessageProducer prod3 = sess2.createProducer(queueA);
        
View Full Code Here

        
         XASession sess2 = conn2.createXASession();
        
         XAResource res = sess2.getXAResource();
        
         Xid xid1 = new MessagingXid("bq1".getBytes(), 42, "eemeli".getBytes());
        
         res.start(xid1, XAResource.TMNOFLAGS);
        
         MessageProducer prod3 = sess2.createProducer(queueA);
        
View Full Code Here

TOP

Related Classes of javax.transaction.xa.Xid

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.