use of org.apache.jena.dboe.transaction.txn.Transaction in project jena by apache.
the class TestTransactionLifecycle2 method txn_direct_03.
@Test
public void txn_direct_03() {
Transaction txn1 = txnMgr.begin(TxnType.WRITE);
txn1.commit();
txn1.end();
checkClear();
}
use of org.apache.jena.dboe.transaction.txn.Transaction in project jena by apache.
the class TestTransactionLifecycle2 method txn_promote_1.
@Test
public void txn_promote_1() {
Transaction txn1 = txnMgr.begin(TxnType.READ_PROMOTE);
assertNotNull(txn1);
boolean b = txn1.promote();
assertTrue(b);
assertEquals(ReadWrite.WRITE, txn1.getMode());
txn1.commit();
txn1.end();
checkClear();
}
use of org.apache.jena.dboe.transaction.txn.Transaction in project jena by apache.
the class StorageTDB method ensureWriteTxn.
// private void requireTxn() {
// if ( ! txnSystem.isInTransaction() )
// throw new TransactionException("Not on a transaction");
// }
private void ensureWriteTxn() {
Transaction txn = txnSystem.getThreadTransaction();
if (txn == null)
throw new TransactionException("Not on a write transaction");
txn.ensureWriteTxn();
}
use of org.apache.jena.dboe.transaction.txn.Transaction in project jena by apache.
the class LoaderMain method indexPhase.
private static void indexPhase(List<BulkStartFinish> processes, TupleIndex srcIdx, TupleIndex[] indexes, MonitorOutput output) {
String indexSetLabel = PhasedOps.indexMappings(indexes);
output.print("Index set: %s => %s", srcIdx.getName(), indexSetLabel);
Indexer indexer = new Indexer(output, indexes);
Destination<Tuple<NodeId>> dest = indexer.index();
indexer.startBulk();
TransactionCoordinator coordinator = CoLib.newCoordinator();
CoLib.add(coordinator, srcIdx);
CoLib.start(coordinator);
// READ transaction.
Transaction transaction = coordinator.begin(TxnType.READ);
// Add to processes - we can wait later if we do not touched indexes being built.
processes.add(indexer);
PhasedOps.ReplayResult result = PhasedOps.replay(srcIdx, dest, output);
// End read transaction on srcIdx
transaction.end();
String timeStr = "---";
if (result.elapsed != 0) {
double time = result.elapsed / 1000.0;
// long AvgRate = (result.items * 1000L) / result.elapsed;
timeStr = String.format("%,.1f", time);
}
output.print("Index set: %s => %s [%,d items, %s seconds]", srcIdx.getName(), indexSetLabel, result.items, timeStr);
}
use of org.apache.jena.dboe.transaction.txn.Transaction in project jena by apache.
the class TestTransactionLifecycle2 method txn_promote_4.
@Test(expected = TransactionException.class)
public void txn_promote_4() {
Transaction txn1 = txnMgr.begin(TxnType.READ);
txn1.end();
txn1.promote();
}
Aggregations