Search in sources :

Example 1 with TxnId

use of org.apache.jena.dboe.transaction.txn.TxnId in project jena by apache.

the class TestTxnId method txnId_3.

@Test
public void txnId_3() {
    TxnId id1 = TxnIdFactory.createSimple();
    TxnId id2 = TxnIdSimple.create(id1.bytes());
    assertNotSame(id1, id2);
    assertEquals(id1, id2);
    assertEquals(id1.name(), id2.name());
}
Also used : TxnId(org.apache.jena.dboe.transaction.txn.TxnId) Test(org.junit.Test)

Example 2 with TxnId

use of org.apache.jena.dboe.transaction.txn.TxnId in project jena by apache.

the class TestTxnId method txnId_1.

@Test
public void txnId_1() {
    TxnId id1 = TxnIdFactory.createSimple();
    assertNotNull(id1);
}
Also used : TxnId(org.apache.jena.dboe.transaction.txn.TxnId) Test(org.junit.Test)

Example 3 with TxnId

use of org.apache.jena.dboe.transaction.txn.TxnId in project jena by apache.

the class TestTxnId method txnId_2.

@Test
public void txnId_2() {
    TxnId id1 = TxnIdFactory.createSimple();
    TxnId id2 = TxnIdFactory.createSimple();
    assertNotSame(id1, id2);
    assertNotEquals(id1, id2);
}
Also used : TxnId(org.apache.jena.dboe.transaction.txn.TxnId) Test(org.junit.Test)

Example 4 with TxnId

use of org.apache.jena.dboe.transaction.txn.TxnId in project jena by apache.

the class DatasetGraphStorage method isolate.

private <T> Iterator<T> isolate(Iterator<T> iterator) {
    if (txn.isInTransaction() && txn instanceof TransactionalSystem) {
        // Needs TxnId to track.
        TransactionalSystem txnSystem = (TransactionalSystem) txn;
        TxnId txnId = txnSystem.getThreadTransaction().getTxnId();
        // Add transaction protection.
        return new IteratorTxnTracker<>(iterator, txnSystem, txnId);
    }
    return Iter.iterator(iterator);
}
Also used : TxnId(org.apache.jena.dboe.transaction.txn.TxnId) TransactionalSystem(org.apache.jena.dboe.transaction.txn.TransactionalSystem) IteratorTxnTracker(org.apache.jena.dboe.transaction.txn.IteratorTxnTracker)

Aggregations

TxnId (org.apache.jena.dboe.transaction.txn.TxnId)4 Test (org.junit.Test)3 IteratorTxnTracker (org.apache.jena.dboe.transaction.txn.IteratorTxnTracker)1 TransactionalSystem (org.apache.jena.dboe.transaction.txn.TransactionalSystem)1