private void checkTransactional() { // Access to booleans is atomic. if ( !haveUsedInTransaction ) { // See http://en.wikipedia.org/wiki/Double-checked_locking // Except we don't have the delayed constructor problem. synchronized (this) { if ( !haveUsedInTransaction ) { // Sync the underlying database in case used // non-transactionally by the application. baseDSG.sync(); } haveUsedInTransaction = true; } } }
@Override public final void sync() { getDatasetGraphTDB().sync(); }
@Override public void commit() { graph.getDatasetGraphTDB().sync(); }
public void syncIfNotTransactional() { if ( !sConn.haveUsedInTransaction() ) sConn.getBaseDataset().sync() ; }
@Override public void sync() { if ( !sConn.haveUsedInTransaction() && get() != null ) get().sync() ; } }
@Override protected synchronized void _close() { if ( isClosed ) return ; if ( sConn.haveUsedInTransaction() ) { if ( isInTransaction() ) { TDB.logInfo.warn("Attempt to close a DatasetGraphTransaction while a transaction is active - ignored close (" + getLocation() + ")") ; return ; } // Otherwise ignore - close() while transactional is meaningless. return ; } synchronized(this) { if ( ! sConn.isValid() ) { // There may be another DatasetGraphTransaction using this location // and that DatasetGraphTransaction has been closed, invalidating // the StoreConnection. return ; } DatasetGraphTDB dsg = sConn.getBaseDataset() ; dsg.sync() ; dsg.close() ; StoreConnection.release(getLocation()) ; dsgtxn.remove() ; inTransaction.remove() ; isClosed = true ; return ; } }
static void forceSync(DatasetGraphTDB dsg) { // Force sync - we have been bypassing DSG tables. // THIS DOES NOT WORK IF modules check for SYNC necessity. dsg.getTripleTable().getNodeTupleTable().getNodeTable().sync() ; dsg.getQuadTable().getNodeTupleTable().getNodeTable().sync() ; dsg.getQuadTable().getNodeTupleTable().getNodeTable().sync() ; dsg.getPrefixes().getNodeTupleTable().getNodeTable().sync() ; // This is not enough -- modules check whether sync needed. dsg.sync() ; } }