jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [4/6] jena git commit: Exclusivity lock should be 'fair' to avoid congestion lock-out.
Date Tue, 23 Aug 2016 15:34:52 GMT
Exclusivity lock should be 'fair' to avoid congestion lock-out.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/f433131b
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/f433131b
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/f433131b

Branch: refs/heads/master
Commit: f433131b781e90239f7ca23a3bb3aaccaeb96f50
Parents: 68965e0
Author: Andy Seaborne <andy@apache.org>
Authored: Mon Aug 22 09:03:38 2016 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Mon Aug 22 09:03:38 2016 +0100

----------------------------------------------------------------------
 .../org/apache/jena/tdb/transaction/TransactionManager.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/f433131b/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 43cb256..4e965fc 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
@@ -138,8 +138,11 @@ public class TransactionManager
     
     // All transactions need a "read" lock throughout their lifetime. 
     // Do not confuse with read/write transactions.  We need a 
-    // "one exclusive, or many other" lock which happens to be called a ReadWriteLock
-    private ReadWriteLock exclusivitylock = new ReentrantReadWriteLock() ;
+    // "one exclusive, or many other" lock which happens to be called a ReadWriteLock.
+    // Fair lock - approximately arrival order. 
+    // Stops "readers" (normal transactions, READ or WRITE) from locking
+    // out a "writer" (exclusive mode).  
+    private ReadWriteLock exclusivitylock = new ReentrantReadWriteLock(true) ;
     
     // Delays enacting transactions.
     private BlockingQueue<Transaction> queue = new LinkedBlockingDeque<>() ;


Mime
View raw message