use of org.apache.jena.tdb.transaction.TDBTransactionException in project jena by apache.
the class LockTx method enterCriticalSection.
@Override
public void enterCriticalSection(boolean readLockRequested) {
if (state != TxNONE)
throw new TDBTransactionException("Illegal state: " + state);
if (readLockRequested) {
state = TxREAD;
dsg.begin(ReadWrite.READ);
} else {
state = TxWRITE;
dsg.begin(ReadWrite.WRITE);
}
}
use of org.apache.jena.tdb.transaction.TDBTransactionException in project jena by apache.
the class TestDatasetPrefixes method dsg_prefixes_txn_2.
// Legacy: TDBTransactionException is not under JenaTransactionException.
@Test(expected = JenaException.class)
public void dsg_prefixes_txn_2() {
Assume.assumeTrue(txnIsolation);
DatasetGraph dsg = create();
Txn.executeRead(dsg, () -> {
PrefixMap pmap = dsg.prefixes();
try {
// Write inside read.
// TIM prefixes are standalone, MRSW so they are thread safe but not tied to the TIM transaction lifecycle.
// No Isolation.
pmap.add("ex", "http://example/2");
} catch (JenaTransactionException | TDBTransactionException ex) {
throw ex;
}
});
}
Aggregations