@Override public void commit() { getBaseHandler().commit(); } }
@Override public void commit() { getBaseHandler().commit(); } }
@Override public Model commit() { getTransactionHandler().commit(); return this; }
@Override public Model commit() { getTransactionHandler().commit(); return this; }
@Override public synchronized void commit() { this.transactionMode = null; if (supportsTransactions(defaultGraph)) { defaultGraph.getTransactionHandler().commit(); } for (RDFServiceGraph graph : graphCache.values()) { if (supportsTransactions(graph)) { graph.getTransactionHandler().commit(); } } graphCache.clear(); }
@Override public void commit() { handlers(h->h.commit()); // Before super.commit - we still hold the lock. finish(); super.commit(); }
private void commitTransaction(SDBConnection sdbConn) { if (sdbConn.getTransactionHandler().transactionsSupported()) { sdbConn.getTransactionHandler().commit(); } }
@Override public void end() { if ( isTransactionMode(ReadWrite.WRITE) ) error("Write transaction - no commit or abort before end()") ; // Need to put this in between the two parts of end(). if ( super.isInTransaction() ) { // Must be READ mode at this point. handlers(h->h.commit()); finish(); } super.endOnce(); } }
/** * Commit the transaction on the graph if transactions are supported. * * @param g */ public static void txnCommit(Graph g) { if (g.getTransactionHandler().transactionsSupported()) { g.getTransactionHandler().commit(); } }
/** * Commit the transaction on the graph if transactions are supported. * * @param g */ public static void txnCommit(Graph g) { if (g.getTransactionHandler().transactionsSupported()) { g.getTransactionHandler().commit(); } }
@Test(expected=JenaException.class) public void sink_graph_txn_5() { DatasetGraph dsg = DatasetGraphSink.create(); Graph g = dsg.getDefaultGraph(); TransactionHandler h = g.getTransactionHandler(); h.commit(); } }
@Test(expected=JenaException.class) public void zero_graph_txn_5() { DatasetGraph dsg = DatasetGraphZero.create(); Graph g = dsg.getDefaultGraph(); TransactionHandler h = g.getTransactionHandler(); h.commit(); }
@Test(expected=JenaException.class) public void zero_graph_txn_4() { DatasetGraph dsg = DatasetGraphZero.create(); Graph g = dsg.getDefaultGraph(); TransactionHandler h = g.getTransactionHandler(); h.begin(); h.commit(); h.abort(); }
@Test(expected=JenaException.class) public void sink_graph_txn_4() { DatasetGraph dsg = DatasetGraphSink.create(); Graph g = dsg.getDefaultGraph(); TransactionHandler h = g.getTransactionHandler(); h.begin(); h.commit(); h.abort(); }
/** Test that Graphs have transaction support methods, and that if they fail on some g they fail because they do not support the operation. */ public void testHasTransactions() { Graph g = getGraph(); TransactionHandler th = g.getTransactionHandler(); th.transactionsSupported(); try { th.begin(); } catch (UnsupportedOperationException x) {} try { th.abort(); } catch (UnsupportedOperationException x) {} try { th.begin(); th.commit(); } catch (UnsupportedOperationException x) {} /* */ Command cmd = new Command() { @Override public Object execute() { return null; } }; try { th.execute( ()->{} ); } catch (UnsupportedOperationException x) {} }
/** Test that Graphs have transaction support methods, and that if they fail on some g they fail because they do not support the operation. */ public void testHasTransactions() { Graph g = getGraph(); TransactionHandler th = g.getTransactionHandler(); th.transactionsSupported(); try { th.begin(); } catch (UnsupportedOperationException x) {} try { th.abort(); } catch (UnsupportedOperationException x) {} try { th.begin(); th.commit(); } catch (UnsupportedOperationException x) {} /* */ Command cmd = new Command() { @Override public Object execute() { return null; } }; try { th.execute( ()->{} ); } catch (UnsupportedOperationException x) {} }
@ContractTest public void testTransactionHandler_Abort() { Graph g = producer.newInstance(); if (g.getTransactionHandler().transactionsSupported()) { Graph initial = graphWith(producer.newInstance(), "initial hasValue 42; also hasURI hello"); Graph extra = graphWith(producer.newInstance(), "extra hasValue 17; also hasURI world"); g.getTransactionHandler().begin(); GraphUtil.addInto(g, initial); g.getTransactionHandler().commit(); g.getTransactionHandler().begin(); GraphUtil.addInto(g, extra); g.getTransactionHandler().abort(); g.getTransactionHandler().begin(); assertIsomorphic(initial, g); g.getTransactionHandler().abort(); } }
@ContractTest public void testTransactionHandler_Abort() { Graph g = producer.newInstance(); if (g.getTransactionHandler().transactionsSupported()) { Graph initial = graphWith(producer.newInstance(), "initial hasValue 42; also hasURI hello"); Graph extra = graphWith(producer.newInstance(), "extra hasValue 17; also hasURI world"); g.getTransactionHandler().begin(); GraphUtil.addInto(g, initial); g.getTransactionHandler().commit(); g.getTransactionHandler().begin(); GraphUtil.addInto(g, extra); g.getTransactionHandler().abort(); g.getTransactionHandler().begin(); assertIsomorphic(initial, g); g.getTransactionHandler().abort(); } }
@ContractTest public void testTransactionHandler_CommitThenAbort() { Graph g = producer.newInstance(); if (g.getTransactionHandler().transactionsSupported()) { Graph initial = graphWith(producer.newInstance(), "Foo pings B; B pings C"); Graph extra = graphWith(producer.newInstance(), "C pingedBy B; fileGraph rdf:type Graph"); g.getTransactionHandler().begin(); GraphUtil.addInto(g, initial); g.getTransactionHandler().commit(); g.getTransactionHandler().begin(); GraphUtil.addInto(g, extra); g.getTransactionHandler().abort(); g.getTransactionHandler().begin(); assertIsomorphic(initial, g); g.getTransactionHandler().abort(); // Model inFile = ModelFactory.createDefaultModel(); // inFile.read( "file:///" + foo, "N-TRIPLES" ); // assertIsomorphic( initial, inFile.getGraph() ); } }
@ContractTest public void testTransactionHandler_CommitThenAbort() { Graph g = producer.newInstance(); if (g.getTransactionHandler().transactionsSupported()) { Graph initial = graphWith(producer.newInstance(), "Foo pings B; B pings C"); Graph extra = graphWith(producer.newInstance(), "C pingedBy B; fileGraph rdf:type Graph"); g.getTransactionHandler().begin(); GraphUtil.addInto(g, initial); g.getTransactionHandler().commit(); g.getTransactionHandler().begin(); GraphUtil.addInto(g, extra); g.getTransactionHandler().abort(); g.getTransactionHandler().begin(); assertIsomorphic(initial, g); g.getTransactionHandler().abort(); // Model inFile = ModelFactory.createDefaultModel(); // inFile.read( "file:///" + foo, "N-TRIPLES" ); // assertIsomorphic( initial, inFile.getGraph() ); } }