You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2018/08/02 13:39:58 UTC
[3/4] jena git commit: Expand internal log error message. Fix some
comments.
Expand internal log error message. Fix some comments.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/3e865e18
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/3e865e18
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/3e865e18
Branch: refs/heads/master
Commit: 3e865e1883b2d4cea700086ba59889636ba1b6b9
Parents: 6dac178
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Aug 2 08:56:03 2018 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Aug 2 08:56:03 2018 +0100
----------------------------------------------------------------------
.../tdb/transaction/TransactionManager.java | 26 +++++++++++---------
1 file changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/3e865e18/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java
index 3a3e5e9..2e3c5ba 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java
@@ -38,6 +38,7 @@ import java.util.concurrent.locks.ReadWriteLock ;
import java.util.concurrent.locks.ReentrantReadWriteLock ;
import org.apache.jena.atlas.lib.Pair ;
+import org.apache.jena.atlas.logging.FmtLog;
import org.apache.jena.atlas.logging.Log ;
import org.apache.jena.query.ReadWrite ;
import org.apache.jena.query.TxnType;
@@ -131,10 +132,9 @@ public class TransactionManager
/*package*/ AtomicLong abortedWriters = new AtomicLong(0) ;
// This is the DatasetGraphTDB for the first read-transaction created for
- // a particular view. The read DatasetGraphTDB can be used by all the readers
- // seeing the same view.
- // A write transaction clears this when it commits; the first reader of a
- // particular state creates the view datasetgraph and sets the lastreader.
+ // a particular view. This read DatasetGraphTDB can be used by all the readers
+ // seeing the same view. A write transaction clears this when it commits; the first
+ // reader of the next state creates a new view DatasetGraph.
private AtomicReference<DatasetGraphTDB> currentReaderView = new AtomicReference<>(null) ;
// Ensure single writer. A writer calling begin(WRITE) blocks.
@@ -282,7 +282,7 @@ public class TransactionManager
// Not implemented
}
- // Policy for writing where a transaction takes an MRSW at the start.
+ // Policy for writing where a transaction takes an MRSW at the start.
// Semaphore for writer entry unnecessary.
class TSM_MRSW_Writer extends TSM_Base
{
@@ -316,6 +316,7 @@ public class TransactionManager
// committerThread.start() ;
}
+ synchronized
public void closedown() {
processDelayedReplayQueue(null) ;
journal.close() ;
@@ -400,9 +401,9 @@ public class TransactionManager
if ( txn.getVersion() != version.get() )
return null;
- // Put ourselves in the serialization timeline of the dataset - that, is grab a writer
+ // Put ourselves in the serialization timeline of the dataset - that is, grab a writer
// lock as a step toward promotion. We can then test properly because no other writer
- // can start; readers can between acquireWriterLock and the synchronized in promote2$
+ // can start; readers can between acquireWriterLock and the synchronized in promoteSync$
// but they don't matter.
// Potentially blocking - must be outside 'synchronized' so that any active writer
// can commit/abort. Otherwise, we have deadlock.
@@ -514,7 +515,7 @@ public class TransactionManager
return dsgTxn ;
}
- /* Signal a transaction has commited. The journal has a commit record
+ /* Signal a transaction has committed. The journal has a commit record
* and a sync to disk. The code here manages the inter-transaction stage
* of deciding how to play the changes back to the base data
* together with general recording of transaction details and status.
@@ -849,9 +850,12 @@ public class TransactionManager
}
private void checkReplaySafe() {
- if ( ! checking ) return ;
- if ( activeReaders.get() != 0 || activeWriters.get() != 0 )
- log.error("There are now active transactions") ;
+ if ( ! checking )
+ return ;
+ long r = activeReaders.get();
+ long w = activeWriters.get();
+ if ( r != 0 || w != 0 )
+ FmtLog.error(log, "checkReplaySafe: There are currently active transactions. R=%d, W=%d", r, w) ;
}
private void noteTxnStart(Transaction transaction) {