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/06/28 08:47:57 UTC

[2/4] jena git commit: Clean up transactions on threads to avoid a (harmless) warning.

Clean up transactions on threads to avoid a (harmless) warning.

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

Branch: refs/heads/master
Commit: 35cbd473ed053fd0ad76f2286d364632b1e29956
Parents: 1fd3936
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jun 26 17:49:03 2018 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Jun 28 09:46:42 2018 +0100

----------------------------------------------------------------------
 .../TestTransactionCoordinatorControl.java      | 36 +++++++++++++++-----
 1 file changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/35cbd473/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTransactionCoordinatorControl.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTransactionCoordinatorControl.java b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTransactionCoordinatorControl.java
index 2b6c962..ee65cfc 100644
--- a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTransactionCoordinatorControl.java
+++ b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTransactionCoordinatorControl.java
@@ -71,19 +71,37 @@ public class TestTransactionCoordinatorControl {
         Transaction txn = L.syncCallThread(()->txnMgr.begin(TxnType.WRITE, false)) ;
         assertNull(txn) ;
         txnMgr.enableWriters();
-        Transaction txn1 = L.syncCallThread(()->txnMgr.begin(TxnType.WRITE, false)) ;
-        assertNotNull(txn1) ;
+        Transaction txn2 = L.syncCallThread(()-> {
+            Transaction txn1 = txnMgr.begin(TxnType.WRITE, false);
+            assertNotNull(txn1);
+            txn1.abort(); txn1.end();
+            return txn1;
+        }) ;
+        assertNotNull(txn2) ;
     }
     
     @Test public void txn_coord_disable_writers_3() {
         txnMgr.blockWriters();
-        Transaction txn = L.syncCallThread(()->txnMgr.begin(TxnType.READ, false)) ;
+        Transaction txn = L.syncCallThread(() -> {
+            Transaction tx = txnMgr.begin(TxnType.READ, false);
+            tx.end();
+            return tx;
+        });
         assertNotNull(txn) ;
         txnMgr.enableWriters();
-        Transaction txn1 = L.syncCallThread(()->txnMgr.begin(TxnType.WRITE, false)) ;
-        assertNotNull(txn1) ;
-        Transaction txn2 = L.syncCallThread(()->txnMgr.begin(TxnType.READ, false)) ;
-        assertNotNull(txn2) ;
+        Transaction txn1 = L.syncCallThread(() -> {
+            Transaction tx = txnMgr.begin(TxnType.WRITE, false);
+            tx.commit();
+            tx.end();
+            return tx;
+        });
+        assertNotNull(txn1);
+        Transaction txn2 = L.syncCallThread(() -> {
+            Transaction tx = txnMgr.begin(TxnType.READ, false);
+            tx.end();
+            return tx;
+        });
+        assertNotNull(txn2);
     }
     
     @Test(expected=TransactionException.class)
@@ -116,6 +134,8 @@ public class TestTransactionCoordinatorControl {
             assertNotNull(txn1) ;
             Transaction txn2 = txnMgr.begin(TxnType.READ, false) ;
             assertNotNull(txn2) ;
+            txn1.commit(); txn1.end();
+            txn2.commit(); txn2.end();
         }) ;
     }
     
@@ -134,7 +154,5 @@ public class TestTransactionCoordinatorControl {
         b = txnMgr.tryExclusiveMode(false);
         assertTrue(b) ;
     }
-    
-    
 }