@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 ; } }
@Test public void store_1() { // Expel. StoreConnection sConn = getStoreConnection() ; DatasetGraphTxn dsgR1 = sConn.begin(TxnType.READ) ; DatasetGraphTxn dsgW1 = sConn.begin(TxnType.WRITE) ; dsgW1.add(q1) ; dsgW1.commit() ; dsgW1.end() ; dsgR1.end() ; assertTrue(sConn.isValid()); StoreConnection.release(sConn.getLocation()) ; assertFalse(sConn.isValid()); sConn = null ; StoreConnection sConn2 = getStoreConnection() ; assertTrue(sConn2.isValid()); }
@Test public void store_1() { // Expel. StoreConnection sConn = getStoreConnection() ; DatasetGraphTxn dsgR1 = sConn.begin(TxnType.READ) ; DatasetGraphTxn dsgW1 = sConn.begin(TxnType.WRITE) ; dsgW1.add(q1) ; dsgW1.commit() ; dsgW1.end() ; dsgR1.end() ; assertTrue(sConn.isValid()); StoreConnection.release(sConn.getLocation()) ; assertFalse(sConn.isValid()); sConn = null ; StoreConnection sConn2 = getStoreConnection() ; assertTrue(sConn2.isValid()); }
@Test public void store_0() { // Expel. StoreConnection sConn = getStoreConnection() ; assertTrue(sConn.isValid()); DatasetGraphTxn dsgW1 = sConn.begin(TxnType.WRITE) ; dsgW1.commit() ; dsgW1.end() ; StoreConnection.release(sConn.getLocation()) ; StoreConnection sConn2 = getStoreConnection() ; }
@Test public void store_0() { // Expel. StoreConnection sConn = getStoreConnection() ; assertTrue(sConn.isValid()); DatasetGraphTxn dsgW1 = sConn.begin(TxnType.WRITE) ; dsgW1.commit() ; dsgW1.end() ; StoreConnection.release(sConn.getLocation()) ; StoreConnection sConn2 = getStoreConnection() ; }