jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [12/14] jena git commit: JENA-1458: Update Txn
Date Thu, 04 Jan 2018 20:46:26 GMT
JENA-1458: Update Txn


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

Branch: refs/heads/master
Commit: 87ab2a7b32ae587c95e9e9262184715d413f3a89
Parents: 1d48cea
Author: Andy Seaborne <andy@apache.org>
Authored: Tue Jan 2 22:50:43 2018 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Tue Jan 2 22:50:43 2018 +0000

----------------------------------------------------------------------
 .../jena/sparql/core/TransactionalLock.java     |  17 ++-
 .../main/java/org/apache/jena/system/Txn.java   | 127 ++++++++++++-------
 .../apache/jena/system/TestTxnLifecycle.java    |  21 +++
 jena-cmds/src/main/java/tdb2/tdbdump.java       |   2 +-
 jena-cmds/src/main/java/tdb2/tdbstats.java      |   2 +-
 .../java/org/apache/jena/dboe/jenax/Txn.java    |  42 ------
 .../dboe/trans/bplustree/TestBPlusTreeTxn.java  |   2 +-
 .../trans/data/TestTransBinaryDataFile.java     |   2 +-
 .../jena/dboe/trans/data/TestTransBlob.java     |   2 +-
 .../trans/data/TestTransBlobPersistent.java     |   2 +-
 .../transaction/TestThreadingTransactions.java  |   2 +-
 .../TestTransactionCoordinatorControl.java      |   2 +-
 .../jena/dboe/transaction/TestTxnLib.java       |   2 +-
 .../jena/dboe/transaction/TestTxnLib2.java      |   2 +-
 .../jena/dboe/transaction/TestTxnSwitching.java |   2 +-
 .../org/apache/jena/tdb2/loader/Loader.java     |   2 +-
 .../java/org/apache/jena/tdb2/sys/CopyDSG.java  |   2 +-
 .../org/apache/jena/tdb2/sys/DatabaseOps.java   |   2 +-
 .../org/apache/jena/tdb2/TestDatabaseMgr.java   |   2 +-
 .../org/apache/jena/tdb2/TestTDBFactory.java    |   2 +-
 .../apache/jena/tdb2/graph/TestGraphsTDB2.java  |   2 +-
 .../apache/jena/tdb2/junit/QueryTestTDB.java    |   2 +-
 .../org/apache/jena/tdb2/solver/TestStats.java  |   2 +-
 .../AbstractTestStoreConnectionBasics.java      |   2 +-
 .../jena/tdb2/store/TestTransactions.java       |   2 +-
 .../apache/jena/tdb2/store/Test_SPARQL_TDB.java |   2 +-
 .../apache/jena/tdb2/sys/TestDatabaseOps.java   |   2 +-
 .../jena/query/text/DatasetGraphText.java       |  12 ++
 28 files changed, 151 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java
index 14d04b8..7086403 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java
@@ -65,8 +65,8 @@ public class TransactionalLock implements Transactional {
     @Override public boolean supportsTransactionAbort() { return false; }
  */
     
-    private ThreadLocal<Boolean> inTransaction = ThreadLocal.withInitial(() -> Boolean.FALSE);
-    private ThreadLocal<TxnType> txnType = ThreadLocal.withInitial(() -> null);
+    private ThreadLocal<Boolean>   inTransaction = ThreadLocal.withInitial(() ->
Boolean.FALSE);
+    private ThreadLocal<TxnType>   txnType = ThreadLocal.withInitial(() -> null);
     private ThreadLocal<ReadWrite> txnMode = ThreadLocal.withInitial(() -> null);
     private final Lock lock ;
 
@@ -112,7 +112,9 @@ public class TransactionalLock implements Transactional {
         ReadWrite readWrite = TxnType.convert(txnType);  
         boolean isRead = readWrite.equals(ReadWrite.READ) ;
         lock.enterCriticalSection(isRead);
-        txnMode.set(readWrite);
+        this.inTransaction.set(true);
+        this.txnMode.set(readWrite);
+        this.txnType.set(txnType);
     }
 
     @Override public ReadWrite transactionMode() {
@@ -144,10 +146,12 @@ public class TransactionalLock implements Transactional {
 
     @Override
     public boolean isInTransaction() {
-        return txnMode.get() != null ;
+        return inTransaction.get();
     }
 
     public boolean isTransactionType(ReadWrite mode) {
+        if ( ! isInTransaction() )
+            return false;
         return Lib.readThreadLocal(txnMode) == mode;
     }
 
@@ -161,7 +165,12 @@ public class TransactionalLock implements Transactional {
     private void endOnce() {
         if ( isInTransaction() ) {
             lock.leaveCriticalSection() ;
+            txnMode.set(null);
+            txnType.set(null);
+            inTransaction.set(false);
             txnMode.remove();
+            txnType.remove();
+            inTransaction.remove();
         }
     }
     

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-arq/src/main/java/org/apache/jena/system/Txn.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/system/Txn.java b/jena-arq/src/main/java/org/apache/jena/system/Txn.java
index 69ad6c6..a0ad64f 100644
--- a/jena-arq/src/main/java/org/apache/jena/system/Txn.java
+++ b/jena-arq/src/main/java/org/apache/jena/system/Txn.java
@@ -20,54 +20,64 @@ package org.apache.jena.system;
 
 import java.util.function.Supplier ;
 
-import org.apache.jena.query.ReadWrite ;
+import org.apache.jena.query.TxnType;
+import org.apache.jena.sparql.JenaTransactionException;
 import org.apache.jena.sparql.core.Transactional ;
 
-/** Application utilities for transactions.
- *  <ul> 
- *  <li>"Autocommit" provided. 
- *  <li>Nested transaction are not supported but calling inside an existing transaction,

- *      which must be compatible, (i.e. a write needs a WRITE transaction).
- *      causes the transaction to be used.
- *  </ul>  
+/** Application utilities for executing code in transactions.
+ * <p>
+ * Nested transaction are not supported but calling inside an existing transaction, 
+ * which must be compatible, (i.e. a write needs a WRITE transaction).
+ * causes the exising transaction to be used.
  */
 
 public class Txn {
-    /** Execute the Runnable in a read transaction. */
-    public static <T extends Transactional> void executeRead(T txn, Runnable r) {
-        boolean b = txn.isInTransaction() ;
-        if ( !b )
-            txn.begin(ReadWrite.READ) ;
-        try { r.run() ; }
-        catch (Throwable th) {
-            onThrowable(th, txn);
-            throw th ;
-        }
-        if ( ! b )
-            txn.end() ;
+    /**
+     * Execute in a "read" transaction that can promote to "write".
+     * <p>
+     * Such a transaction may abort if an update is executed
+     * by another thread before this one is promoted to "write" mode.
+     * If so, the data protected by {@code txn} is unchanaged.
+     * <p>
+     * If the application knows updates will be needed, consider using {@link #executeWrite}
+     * which starts in "write" mode.
+     * <p>
+     * The application code can call {@link Transactional#promote} to attempt to
+     * change from "read" to "write"; the {@link Transactional#promote promote} method
+     * returns a boolean indicating whether the promotion was possible or not. 
+     */
+    public static <T extends Transactional> void exec(T txn, Runnable r) {
+        exec(txn, TxnType.READ_PROMOTE, r);
     }
-    
-    /** Execute and return a value in a read transaction */
-    public static <T extends Transactional, X> X calculateRead(T txn, Supplier<X>
r) {
-        boolean b = txn.isInTransaction() ;
-        if ( !b )
-            txn.begin(ReadWrite.READ) ;
-        try {
-            X x = r.get() ;
-            if ( !b )
-                txn.end() ;
-            return x ;
-        } catch (Throwable th) {
-            onThrowable(th, txn);
-            throw th ;
-        }
+
+    /**
+     * Execute in a "read" transaction that can promote to "write" and return some calculated
value. 
+     * <p>
+     * Such a transaction may abort if an update is executed
+     * by another thread before this one is promoted to "write" mode.
+     * If so, the data protected by {@code txn} is unchanaged.
+     * <p>
+     * If the application knows updates will be needed, consider using {@link #executeWrite}
+     * which starts in "write" mode.
+     * <p>
+     * The application code can call {@link Transactional#promote} to attempt to
+     * change from "read" to "write"; the {@link Transactional#promote promote} method
+     * returns a boolean indicating whether the promotion was possible or not. 
+     */
+    public static <T extends Transactional, X> X calc(T txn, Supplier<X> r) {
+        return calc(txn, TxnType.READ_PROMOTE, r);
     }
 
-    /** Execute the Runnable in a write transaction */
-    public static <T extends Transactional> void executeWrite(T txn, Runnable r) {
+    /** Execute application code in a transaction with the given {@link TxnType trasnaction
type}. */
+    public static <T extends Transactional> void exec(T txn, TxnType txnType, Runnable
r) {
         boolean b = txn.isInTransaction() ;
-        if ( !b )
-            txn.begin(ReadWrite.WRITE) ;
+        if ( b )  {
+            TxnType txnTypeOuter = txn.transactionType();
+            if ( txnTypeOuter != txnType )
+                throw new JenaTransactionException("Already in a transaction of a different
type: "
+                                                  +"outer="+txnTypeOuter+" : inner="+txnType);
+        } else
+            txn.begin(txnType) ;
         try { r.run() ; }
         catch (Throwable th) {
             onThrowable(th, txn);
@@ -81,24 +91,51 @@ public class Txn {
         }
     }
 
-    /** Execute and return a value in a write transaction. */
-    public static <T extends Transactional, X> X calculateWrite(T txn, Supplier<X>
r) {
+    /** Execute and return a value in a transaction with the given {@link TxnType trasnaction
type}. */
+    public static <T extends Transactional, X> X calc(T txn, TxnType txnType, Supplier<X>
r) {
         boolean b = txn.isInTransaction() ;
-        if ( !b )
-            txn.begin(ReadWrite.WRITE) ;
-        X x = null ;
+        if ( b )  {
+            TxnType txnTypeOuter = txn.transactionType();
+            if ( txnTypeOuter != txnType )
+                throw new JenaTransactionException("Already in a transaction of a different
type: "
+                                                  +"outer="+txnTypeOuter+" : inner="+txnType);
+        } else
+            txn.begin(txnType) ;
+    
+        X x;
         try { x = r.get() ; } 
         catch (Throwable th) {
             onThrowable(th, txn);
             throw th ;
         }
+        
         if ( !b ) {
             if ( txn.isInTransaction() )
                 // May have been explicit commit or abort.
                 txn.commit() ;
             txn.end() ;
         }
-        return x ;
+        return x;
+    }
+
+    /** Execute in a read transaction */
+    public static <T extends Transactional> void executeRead(T txn, Runnable r) {
+        exec(txn, TxnType.READ, r);
+    }
+    
+    /** Execute and return a value in a read transaction */
+    public static <T extends Transactional, X> X calculateRead(T txn, Supplier<X>
r) {
+        return calc(txn, TxnType.READ, r);
+    }
+
+    /** Execute the Runnable in a write transaction */
+    public static <T extends Transactional> void executeWrite(T txn, Runnable r) {
+        exec(txn, TxnType.WRITE, r);
+    }
+
+    /** Execute and return a value in a write transaction. */
+    public static <T extends Transactional, X> X calculateWrite(T txn, Supplier<X>
r) {
+        return calc(txn, TxnType.WRITE, r);
     }
     
     // Attempt some kind of cleanup.

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-arq/src/test/java/org/apache/jena/system/TestTxnLifecycle.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/system/TestTxnLifecycle.java b/jena-arq/src/test/java/org/apache/jena/system/TestTxnLifecycle.java
index 8be8ae9..76ae02e 100644
--- a/jena-arq/src/test/java/org/apache/jena/system/TestTxnLifecycle.java
+++ b/jena-arq/src/test/java/org/apache/jena/system/TestTxnLifecycle.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.* ;
 
 import java.util.concurrent.atomic.AtomicLong ;
 
+import org.apache.jena.sparql.JenaTransactionException;
 import org.apache.jena.sparql.core.Transactional ;
 import org.apache.jena.sparql.core.TransactionalLock ;
 import org.apache.jena.system.Txn ;
@@ -62,6 +63,25 @@ public class TestTxnLifecycle {
         assertEquals(56,x) ;
     }
     
+    @Test(expected=JenaTransactionException.class)
+    public void txn_lifecycle_05a() {
+        int x = Txn.calculateRead(trans, ()-> {
+            // Does not continue outer transaction.
+            return Txn.calculateWrite(trans, ()->56) ;
+        });
+        assertEquals(56,x) ;
+    }
+    
+    @Test(expected=JenaTransactionException.class)
+    public void txn_lifecycle_05b() {
+        int x = Txn.calculateWrite(trans, ()-> {
+            // Does not continue outer transaction.
+            return Txn.calculateRead(trans, ()->56) ;
+        });
+        assertEquals(56,x) ;
+    }
+
+    
     @Test(expected=ExceptionFromTest.class)
     public void txn_lifecycle_06() {
         int x = Txn.calculateWrite(trans, ()-> {
@@ -71,6 +91,7 @@ public class TestTxnLifecycle {
         fail("Should not be here!") ;
     }
     
+    
     @Test public void txn_lifecycle_07() {
         Txn.executeWrite(trans, ()->trans.commit()) ; 
     }

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-cmds/src/main/java/tdb2/tdbdump.java
----------------------------------------------------------------------
diff --git a/jena-cmds/src/main/java/tdb2/tdbdump.java b/jena-cmds/src/main/java/tdb2/tdbdump.java
index e8bd728..74f1e61 100644
--- a/jena-cmds/src/main/java/tdb2/tdbdump.java
+++ b/jena-cmds/src/main/java/tdb2/tdbdump.java
@@ -20,7 +20,7 @@ package tdb2;
 
 import arq.cmdline.ModLangOutput ;
 import jena.cmd.CmdException ;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.riot.RDFFormat ;
 import org.apache.jena.riot.RDFLanguages ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-cmds/src/main/java/tdb2/tdbstats.java
----------------------------------------------------------------------
diff --git a/jena-cmds/src/main/java/tdb2/tdbstats.java b/jena-cmds/src/main/java/tdb2/tdbstats.java
index 19797d0..0524ab5 100644
--- a/jena-cmds/src/main/java/tdb2/tdbstats.java
+++ b/jena-cmds/src/main/java/tdb2/tdbstats.java
@@ -22,7 +22,7 @@ import java.util.Iterator ;
 
 import org.apache.jena.atlas.lib.tuple.Tuple ;
 import org.apache.jena.atlas.logging.Log ;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.sparql.core.Quad ;
 import org.apache.jena.tdb2.solver.SolverLib;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-dboe-base/src/main/java/org/apache/jena/dboe/jenax/Txn.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-base/src/main/java/org/apache/jena/dboe/jenax/Txn.java b/jena-db/jena-dboe-base/src/main/java/org/apache/jena/dboe/jenax/Txn.java
deleted file mode 100644
index def9d47..0000000
--- a/jena-db/jena-dboe-base/src/main/java/org/apache/jena/dboe/jenax/Txn.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.dboe.jenax;
-
-import java.util.function.Supplier ;
-
-import org.apache.jena.sparql.core.Transactional ;
-
-/** Indirection to allow for modification for TDB2 capabilities */
-public class Txn {
-    public static <T extends Transactional> void executeRead(T txn, Runnable r) {
-        org.apache.jena.system.Txn.executeRead(txn, r);
-    }
-
-    public static <T extends Transactional, X> X calculateRead(T txn, Supplier<X>
r) {
-        return org.apache.jena.system.Txn.calculateRead(txn, r);
-    }
-
-    public static <T extends Transactional> void executeWrite(T txn, Runnable r) {
-        org.apache.jena.system.Txn.executeWrite(txn, r);
-    }
-
-    public static <T extends Transactional, X> X calculateWrite(T txn, Supplier<X>
r) {
-        return org.apache.jena.system.Txn.calculateWrite(txn, r);
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/bplustree/TestBPlusTreeTxn.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/bplustree/TestBPlusTreeTxn.java
b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/bplustree/TestBPlusTreeTxn.java
index 8a9f673..321d3ae 100644
--- a/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/bplustree/TestBPlusTreeTxn.java
+++ b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/bplustree/TestBPlusTreeTxn.java
@@ -20,7 +20,7 @@ package org.apache.jena.dboe.trans.bplustree;
 
 import org.apache.jena.dboe.base.file.Location;
 import org.apache.jena.dboe.index.test.IndexTestLib;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.dboe.test.RecordLib;
 import org.apache.jena.dboe.trans.bplustree.BPlusTree;
 import org.apache.jena.dboe.trans.bplustree.BPlusTreeFactory;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBinaryDataFile.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBinaryDataFile.java
b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBinaryDataFile.java
index 996749b..3c15e7d 100644
--- a/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBinaryDataFile.java
+++ b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBinaryDataFile.java
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertNotEquals;
 import org.apache.jena.atlas.lib.Bytes ;
 import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.dboe.base.file.*;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.dboe.trans.data.TransBinaryDataFile;
 import org.apache.jena.dboe.transaction.Transactional;
 import org.apache.jena.dboe.transaction.TransactionalFactory;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlob.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlob.java
b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlob.java
index 95be5dd..36531a5 100644
--- a/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlob.java
+++ b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlob.java
@@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicReference ;
 import org.apache.jena.dboe.base.file.BufferChannel;
 import org.apache.jena.dboe.base.file.BufferChannelMem;
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.dboe.trans.data.TransBlob;
 import org.apache.jena.dboe.transaction.Transactional;
 import org.apache.jena.dboe.transaction.TransactionalFactory;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlobPersistent.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlobPersistent.java
b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlobPersistent.java
index fe8e3bb..5000c4a 100644
--- a/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlobPersistent.java
+++ b/jena-db/jena-dboe-trans-data/src/test/java/org/apache/jena/dboe/trans/data/TestTransBlobPersistent.java
@@ -24,7 +24,7 @@ import org.apache.jena.atlas.lib.FileOps ;
 import org.apache.jena.dboe.base.file.BufferChannel;
 import org.apache.jena.dboe.base.file.BufferChannelFile;
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.dboe.trans.data.TransBlob;
 import org.apache.jena.dboe.transaction.Transactional;
 import org.apache.jena.dboe.transaction.TransactionalFactory;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestThreadingTransactions.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestThreadingTransactions.java
b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestThreadingTransactions.java
index 8b2bf64..5ea41e8 100644
--- a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestThreadingTransactions.java
+++ b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestThreadingTransactions.java
@@ -21,7 +21,7 @@ package org.apache.jena.dboe.transaction;
 import java.util.concurrent.Semaphore ;
 
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.system.ThreadAction;
 import org.apache.jena.system.ThreadTxn;
 import org.apache.jena.dboe.transaction.txn.TransactionCoordinator;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/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 f99b37a..2b6c962 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
@@ -24,7 +24,7 @@ import java.util.concurrent.Semaphore ;
 import java.util.concurrent.atomic.AtomicInteger ;
 
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.dboe.migrate.L;
 import org.apache.jena.dboe.transaction.txn.Transaction;
 import org.apache.jena.dboe.transaction.txn.TransactionCoordinator;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib.java
b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib.java
index e8bf804..a4e39dc 100644
--- a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib.java
+++ b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.fail ;
 
 import org.apache.jena.system.ThreadTxn;
 import org.apache.jena.system.ThreadAction;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.query.ReadWrite ;
 import org.junit.Test ;
 

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib2.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib2.java
b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib2.java
index 463f7f9..ccd1515 100644
--- a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib2.java
+++ b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnLib2.java
@@ -20,7 +20,7 @@ package org.apache.jena.dboe.transaction;
 
 import org.apache.jena.atlas.lib.Pair ;
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.dboe.transaction.txn.TransactionCoordinator;
 import org.junit.After ;
 import org.junit.Assert ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnSwitching.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnSwitching.java
b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnSwitching.java
index d32fd55..6e8df63 100644
--- a/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnSwitching.java
+++ b/jena-db/jena-dboe-transaction/src/test/java/org/apache/jena/dboe/transaction/TestTxnSwitching.java
@@ -22,7 +22,7 @@ import static org.junit.Assert.assertEquals ;
 import static org.junit.Assert.fail ;
 
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.dboe.transaction.txn.*;
 import org.apache.jena.dboe.transaction.txn.journal.Journal;
 import org.apache.jena.query.ReadWrite ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/Loader.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/Loader.java b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/Loader.java
index 1dbb5f0..3b97757 100644
--- a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/Loader.java
+++ b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/Loader.java
@@ -20,7 +20,7 @@ package org.apache.jena.tdb2.loader;
 
 import org.apache.jena.atlas.lib.ProgressMonitor ;
 import org.apache.jena.atlas.logging.FmtLog ;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.riot.system.ProgressStreamRDF ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/CopyDSG.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/CopyDSG.java b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/CopyDSG.java
index bb9f846..f751d3e 100644
--- a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/CopyDSG.java
+++ b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/CopyDSG.java
@@ -22,7 +22,7 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.jena.atlas.iterator.Iter;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.graph.Graph;
 import org.apache.jena.graph.Node;
 import org.apache.jena.sparql.core.DatasetGraph;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/DatabaseOps.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/DatabaseOps.java b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/DatabaseOps.java
index db9976a..a673e94 100644
--- a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/DatabaseOps.java
+++ b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/DatabaseOps.java
@@ -30,7 +30,7 @@ import org.apache.jena.atlas.lib.DateTimeUtils ;
 import org.apache.jena.atlas.lib.Pair ;
 import org.apache.jena.atlas.logging.Log;
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.dboe.transaction.txn.TransactionCoordinator;
 import org.apache.jena.dboe.transaction.txn.TransactionalSystem;
 import org.apache.jena.riot.Lang ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestDatabaseMgr.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestDatabaseMgr.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestDatabaseMgr.java
index 808c632..699bbb8 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestDatabaseMgr.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestDatabaseMgr.java
@@ -21,7 +21,7 @@ package org.apache.jena.tdb2;
 import static org.junit.Assert.*;
 import org.apache.jena.atlas.lib.FileOps ;
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.sparql.core.DatasetGraph ;
 import org.apache.jena.sparql.core.Quad ;
 import org.apache.jena.sparql.sse.SSE ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestTDBFactory.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestTDBFactory.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestTDBFactory.java
index cd6d965..fc3af0c 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestTDBFactory.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestTDBFactory.java
@@ -22,7 +22,7 @@ import static org.junit.Assert.*;
 import org.apache.jena.atlas.lib.FileOps ;
 import org.apache.jena.datatypes.xsd.XSDDatatype ;
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.rdf.model.Literal ;
 import org.apache.jena.rdf.model.Property ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/graph/TestGraphsTDB2.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/graph/TestGraphsTDB2.java
b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/graph/TestGraphsTDB2.java
index 7d6843c..71765d2 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/graph/TestGraphsTDB2.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/graph/TestGraphsTDB2.java
@@ -18,7 +18,7 @@
 
 package org.apache.jena.tdb2.graph;
 
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.query.ReadWrite ;
 import org.apache.jena.tdb2.TDB2Factory;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/QueryTestTDB.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/QueryTestTDB.java
b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/QueryTestTDB.java
index acfb7f4..57822e6 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/QueryTestTDB.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/QueryTestTDB.java
@@ -20,7 +20,7 @@ package org.apache.jena.tdb2.junit;
 
 import java.util.List ;
 
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.query.* ;
 import org.apache.jena.rdf.model.Model ;
 import org.apache.jena.sparql.SystemARQ ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/solver/TestStats.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/solver/TestStats.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/solver/TestStats.java
index 8be9d87..2b52e94 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/solver/TestStats.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/solver/TestStats.java
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals ;
 import java.util.Iterator ;
 
 import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.graph.NodeFactory ;
 import org.apache.jena.sparql.core.Quad ;
 import org.apache.jena.sparql.sse.SSE ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/AbstractTestStoreConnectionBasics.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/AbstractTestStoreConnectionBasics.java
b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/AbstractTestStoreConnectionBasics.java
index 42538d7..55d9b9a 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/AbstractTestStoreConnectionBasics.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/AbstractTestStoreConnectionBasics.java
@@ -22,7 +22,7 @@ package org.apache.jena.tdb2.store;
 import static org.junit.Assert.*;
 
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.query.ReadWrite ;
 import org.apache.jena.sparql.core.Quad ;
 import org.apache.jena.sparql.sse.SSE ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/TestTransactions.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/TestTransactions.java
b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/TestTransactions.java
index 787ec7e..acabff4 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/TestTransactions.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/TestTransactions.java
@@ -25,7 +25,7 @@ import org.apache.jena.atlas.iterator.Iter ;
 import static org.junit.Assert.*;
 import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.dboe.transaction.txn.TransactionException;
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.query.ReadWrite;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/Test_SPARQL_TDB.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/Test_SPARQL_TDB.java
b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/Test_SPARQL_TDB.java
index cb335af..cb618ab 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/Test_SPARQL_TDB.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/store/Test_SPARQL_TDB.java
@@ -21,7 +21,7 @@ package org.apache.jena.tdb2.store;
 import static org.junit.Assert.*;
 import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.graph.Graph ;
 import org.apache.jena.graph.NodeFactory ;
 import org.apache.jena.graph.Triple ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
index 477a9e0..9e171d2 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
@@ -26,7 +26,7 @@ import static org.junit.Assert.assertTrue ;
 import org.apache.commons.io.FileUtils ;
 import org.apache.jena.atlas.lib.FileOps ;
 import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.dboe.jenax.Txn;
+import org.apache.jena.system.Txn;
 import org.apache.jena.graph.Graph ;
 import org.apache.jena.graph.Triple ;
 import org.apache.jena.riot.RDFDataMgr ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87ab2a7b/jena-text/src/main/java/org/apache/jena/query/text/DatasetGraphText.java
----------------------------------------------------------------------
diff --git a/jena-text/src/main/java/org/apache/jena/query/text/DatasetGraphText.java b/jena-text/src/main/java/org/apache/jena/query/text/DatasetGraphText.java
index 4ac491f..a1dcb92 100644
--- a/jena-text/src/main/java/org/apache/jena/query/text/DatasetGraphText.java
+++ b/jena-text/src/main/java/org/apache/jena/query/text/DatasetGraphText.java
@@ -24,6 +24,7 @@ import java.util.List ;
 import org.apache.jena.graph.Graph ;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.query.ReadWrite ;
+import org.apache.jena.query.TxnType;
 import org.apache.jena.sparql.core.* ;
 import org.apache.lucene.queryparser.classic.QueryParserBase ;
 import org.slf4j.Logger ;
@@ -106,6 +107,17 @@ public class DatasetGraphText extends DatasetGraphMonitor implements
Transaction
     }
 
     @Override
+    public void begin(TxnType txnType) {
+        switch(txnType) {
+            case READ_PROMOTE:
+            case READ_COMMITTED_PROMOTE:
+                throw new UnsupportedOperationException("begin("+txnType+")");
+            default:
+        }
+        begin(TxnType.convert(txnType));
+    }
+    
+    @Override
     public void begin(ReadWrite readWrite) {
         // Do not synchronized(txnLock) here. It will deadlock because if there
         // is an writer in commit, it can't 


Mime
View raw message