Repository: jena Updated Branches: refs/heads/master fad8cfaae -> 293fc7297
Fix close/sync problems Project: http://git-wip-us.apache.org/repos/asf/jena/repo Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/293fc729 Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/293fc729 Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/293fc729 Branch: refs/heads/master Commit: 293fc729795ed7add3918322c4fc4dc4fce75d74 Parents: fad8cfa Author: Andy Seaborne <[email protected]> Authored: Thu Mar 3 18:50:22 2016 +0000 Committer: Andy Seaborne <[email protected]> Committed: Thu Mar 3 18:50:22 2016 +0000 ---------------------------------------------------------------------- .../transaction/DatasetGraphTransaction.java | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jena/blob/293fc729/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTransaction.java ---------------------------------------------------------------------- diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTransaction.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTransaction.java index 2d892d3..e37ba2f 100644 --- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTransaction.java +++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTransaction.java @@ -193,25 +193,27 @@ import org.apache.jena.tdb.store.DatasetGraphTDB ; protected void _close() { if ( isClosed ) return ; - isClosed = true ; - - if ( !sConn.haveUsedInTransaction() && get() != null ) { - // Non-transactional behaviour. - DatasetGraphTDB dsg = get() ; - dsg.sync() ; - dsg.close() ; - StoreConnection.release(dsg.getLocation()) ; - isClosed = true ; - return ; + + if ( !sConn.haveUsedInTransaction() ) { + synchronized(this) { + if ( isClosed ) return ; + isClosed = true ; + // Non-transactional behaviour. + DatasetGraphTDB dsg = sConn.getBaseDataset() ; + dsg.sync() ; + dsg.close() ; + StoreConnection.release(dsg.getLocation()) ; + return ; + } } if ( isInTransaction() ) { - TDB.logInfo.warn("Attempt to close a DatasetGraphTransaction while a transaction is active - ignored close (" + getLocation() - + ")") ; + TDB.logInfo.warn("Attempt to close a DatasetGraphTransaction while a transaction is active - ignored close (" + getLocation() + ")") ; return ; } txn.remove() ; inTransaction.remove() ; + isClosed = true ; } @Override
