@Override public void commit() { try { if ( needFinish ) { super.getMonitor().finish() ; //spatialIndex.finishIndexing() ; } needFinish = false ; //spatialIndex.commit() ; super.commit() ; } catch (Throwable ex) { log.warn("Exception in commit: "+ex.getMessage(), ex) ; super.abort() ; } }
@Override public void begin(ReadWrite readWrite) { // Do not synchronized(txnLock) here. It will deadlock because if there // is an writer in commit, it can't // The "super.begin" is enough. readWriteMode.set(readWrite); super.begin(readWrite) ; super.getMonitor().start() ; }
@Override public void end() { try { //spatialIndex.end() ; super.end() ; } catch (Throwable ex) { log.warn("Exception in end: "+ex.getMessage(), ex) ; } }
@Override public void end() { if ( ! isInTransaction() ) { super.end() ; return; } if (readWriteMode.get() == ReadWrite.WRITE) { // If we are still in a write transaction at this point, then commit // was never called, so rollback the TextIndex and the dataset. abortAction.run(); } super.end() ; super.getMonitor().finish() ; readWriteMode.set(null) ; }
private void commit_W() { synchronized(txnExitLock) { super.getMonitor().finish() ; super.commit(); textIndex.commit();
private void abort_R() { try { super.abort() ; } catch (Throwable t) { log.warn("Exception in abort: " + t.getMessage(), t); } }
/** Declare whether {@link #abort} is supported. * This goes along with clearing up after exceptions inside application transaction code. */ @Override public boolean supportsTransactionAbort() { return super.supportsTransactionAbort() ; }
@Override public void commit() { super.getMonitor().finish() ; commitAction.run(); readWriteMode.set(null); }
@Override public boolean supportsTransactions() { return super.supportsTransactions() ; }
private void commit_R() { // No index action needed. super.commit(); }
@Test public void countChanges_01() { DatasetGraph dsgBase = DatasetGraphFactory.create() ; DatasetChangesCounter dsgChanges = new DatasetChangesCounter() ; DatasetGraph dsg = new DatasetGraphMonitor(dsgBase, dsgChanges) ; check(dsgChanges, 0, 0, 0, 0) ; dsg.add(quad1) ; check(dsgChanges, 1, 0, 0, 0) ; }
@Override public void addGraph(Node gn, Graph g) { // Convert to quads. //super.addGraph(gn, g) ; ExtendedIterator<Triple> iter = g.find(Node.ANY, Node.ANY, Node.ANY) ; for ( ; iter.hasNext(); ) { Triple t = iter.next() ; add(gn, t.getSubject(), t.getPredicate(), t.getObject()) ; } }
@Override public void end() { if ( ! isInTransaction() ) { super.end() ; return; } if (readWriteMode.get() == ReadWrite.WRITE) { // If we are still in a write transaction at this point, then commit // was never called, so rollback the TextIndex and the dataset. abortAction.run(); } super.end() ; super.getMonitor().finish() ; readWriteMode.set(null) ; }
private void commit_W() { synchronized(txnExitLock) { super.getMonitor().finish() ; super.commit(); textIndex.commit();
private void abort_R() { try { super.abort() ; } catch (Throwable t) { log.warn("Exception in abort: " + t.getMessage(), t); } }
/** Declare whether {@link #abort} is supported. * This goes along with clearing up after exceptions inside application transaction code. */ @Override public boolean supportsTransactionAbort() { return super.supportsTransactionAbort() ; } }
/** * Rollback all changes, discarding any exceptions that occur. */ @Override public void abort() { super.getMonitor().finish() ; abortAction.run(); readWriteMode.set(null); }
@Override public boolean supportsTransactions() { return super.supportsTransactions() ; }