/** * 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()); }
/** * 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()); }
public BitronixTransaction() { Uid gtrid = UidGenerator.generateUid(); if (log.isDebugEnabled()) log.debug("creating new transaction with GTRID [" + gtrid + "]"); this.resourceManager = new XAResourceManager(gtrid); this.threadName = Thread.currentThread().getName(); }
public BitronixTransaction() { Uid gtrid = UidGenerator.generateUid(); if (log.isDebugEnabled()) { log.debug("creating new transaction with GTRID [" + gtrid + "]"); } this.resourceManager = new XAResourceManager(gtrid); this.threadName = Thread.currentThread().getName(); }
public BitronixTransaction() { Uid gtrid = UidGenerator.generateUid(); if (log.isDebugEnabled()) log.debug("creating new transaction with GTRID [" + gtrid + "]"); this.resourceManager = new XAResourceManager(gtrid); this.threadName = Thread.currentThread().getName(); }
/** * 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()); }
/** * 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()); }
public BitronixTransaction() { Uid gtrid = UidGenerator.generateUid(); if (log.isDebugEnabled()) { log.debug("creating new transaction with GTRID [" + gtrid + "]"); } this.resourceManager = new XAResourceManager(gtrid); this.threadName = Thread.currentThread().getName(); }
@Override public Set<Uid> call() throws Exception { Set<Uid> ids = new HashSet<Uid>(callsPerThread); for (int i = 0; i < callsPerThread; i++) ids.add(UidGenerator.generateUid()); return ids; } }));
@Override public Set<Uid> call() throws Exception { Set<Uid> ids = new HashSet<Uid>(callsPerThread); for (int i = 0; i < callsPerThread; i++) ids.add(UidGenerator.generateUid()); return ids; } }));
public void testUniqueness() throws Exception { final int count = 10000; HashSet<String> uids = new HashSet<String>(2048); for (int i = 0; i < count; i++) { Uid uid = UidGenerator.generateUid(); assertTrue("UidGenerator generated duplicate UID at #" + i, uids.add(uid.toString())); } }
public void testUniqueness() throws Exception { final int count = 10000; HashSet<String> uids = new HashSet<String>(2048); for (int i = 0; i < count; i++) { Uid uid = UidGenerator.generateUid(); assertTrue("UidGenerator generated duplicate UID at #" + i, uids.add(uid.toString())); } }
public void testEquals() throws Exception { Uid uid1 = UidGenerator.generateUid(); Uid uid2 = UidGenerator.generateUid(); Uid uid3 = null; assertFalse(uid1.equals(uid2)); assertFalse(uid2.equals(uid3)); assertTrue(uid2.equals(uid2)); }
public void testEquals() throws Exception { Uid uid1 = UidGenerator.generateUid(); Uid uid2 = UidGenerator.generateUid(); Uid uid3 = null; assertFalse(uid1.equals(uid2)); assertFalse(uid2.equals(uid3)); assertTrue(uid2.equals(uid2)); }
public void testSimpleCollectDanglingRecords() throws Exception { DiskJournal journal = new DiskJournal(); journal.open(); Uid gtrid = UidGenerator.generateUid(); assertEquals(0, journal.collectDanglingRecords().size()); journal.log(Status.STATUS_COMMITTING, gtrid, csvToSet("name1")); assertEquals(1, journal.collectDanglingRecords().size()); journal.log(Status.STATUS_COMMITTED, gtrid, csvToSet("name1")); assertEquals(0, journal.collectDanglingRecords().size()); journal.close(); journal.shutdown(); }
public void testSimpleCollectDanglingRecords() throws Exception { DiskJournal journal = new DiskJournal(); journal.open(); Uid gtrid = UidGenerator.generateUid(); assertEquals(0, journal.collectDanglingRecords().size()); journal.log(Status.STATUS_COMMITTING, gtrid, csvToSet("name1")); assertEquals(1, journal.collectDanglingRecords().size()); journal.log(Status.STATUS_COMMITTED, gtrid, csvToSet("name1")); assertEquals(0, journal.collectDanglingRecords().size()); journal.close(); journal.shutdown(); }
/** * Create 3 XIDs on the resource that are not in the journal -> recoverer presumes they have aborted and rolls * them back. * @throws Exception */ public void testIncrementalRecoverPresumedAbort() throws Exception { byte[] gtrid = UidGenerator.generateUid().getArray(); xaResource.addInDoubtXid(new MockXid(0, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(1, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(2, gtrid, BitronixXid.FORMAT_ID)); IncrementalRecoverer.recover(pds); assertEquals(0, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length); }
/** * Create 3 XIDs on the resource that are not in the journal -> recoverer presumes they have aborted and rolls * them back. * @throws Exception */ public void testIncrementalRecoverPresumedAbort() throws Exception { byte[] gtrid = UidGenerator.generateUid().getArray(); xaResource.addInDoubtXid(new MockXid(0, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(1, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(2, gtrid, BitronixXid.FORMAT_ID)); IncrementalRecoverer.recover(pds); assertEquals(0, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length); }
/** * Create 3 XIDs on the resource that are not in the journal -> recoverer presumes they have aborted and rolls * them back. * @throws Exception */ public void testRecoverPresumedAbort() throws Exception { byte[] gtrid = UidGenerator.generateUid().getArray(); xaResource.addInDoubtXid(new MockXid(0, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(1, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(2, gtrid, BitronixXid.FORMAT_ID)); TransactionManagerServices.getRecoverer().run(); assertEquals(0, TransactionManagerServices.getRecoverer().getCommittedCount()); assertEquals(3, TransactionManagerServices.getRecoverer().getRolledbackCount()); assertEquals(0, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length); }
/** * Create 3 XIDs on the resource that are not in the journal -> recoverer presumes they have aborted and rolls * them back. * @throws Exception */ public void testRecoverPresumedAbort() throws Exception { byte[] gtrid = UidGenerator.generateUid().getArray(); xaResource.addInDoubtXid(new MockXid(0, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(1, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(2, gtrid, BitronixXid.FORMAT_ID)); TransactionManagerServices.getRecoverer().run(); assertEquals(0, TransactionManagerServices.getRecoverer().getCommittedCount()); assertEquals(3, TransactionManagerServices.getRecoverer().getRolledbackCount()); assertEquals(0, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length); }