[java-plugin-storage-jdbc] 02/02: JJDBC-19 Re-introduction of https://shibboleth.atlassian.net/browse/IDP-1020 ?

Rod Widdowson rdw at steadingsoftware.com
Sat Aug 5 10:41:09 UTC 2023


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-plugin-storage-jdbc.

View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-storage-jdbc.git;a=commit;h=81d1069c0f4cbd31400f82cd0230d3e5684a7032

commit 81d1069c0f4cbd31400f82cd0230d3e5684a7032
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Aug 5 11:39:41 2023 +0100

    JJDBC-19 Re-introduction of https://shibboleth.atlassian.net/browse/IDP-1020 ?
    
    https://shibboleth.atlassian.net/browse/JJDBC-19
    
    Allow "p:transactionIsolation=0" to be used to turn off isolation
    at the Connection level.
---
 .../shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java  | 9 +++------
 .../plugin/storage/jdbc/impl/JDBCStorageServiceTest.java         | 1 +
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
index ecd6b37..0a9b6e2 100644
--- a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
+++ b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
@@ -286,11 +286,6 @@ public final class JDBCStorageService extends AbstractStorageService
      * @param what the value to set
      */
     public void setTransactionIsolation(final int what) {
-        Constraint.isTrue(what == Connection.TRANSACTION_READ_COMMITTED ||
-                          what == Connection.TRANSACTION_READ_UNCOMMITTED ||
-                          what == Connection.TRANSACTION_REPEATABLE_READ ||
-                          what == Connection.TRANSACTION_SERIALIZABLE,
-                          "Invalid value for TransactionIsolation");
         transactionIsolation = what;
     }
 
@@ -1215,7 +1210,9 @@ public final class JDBCStorageService extends AbstractStorageService
             assert con != null;
             connection = con;
             connection.setAutoCommit(autoCommit);
-            connection.setTransactionIsolation(transactionIsolation);
+            if (transactionIsolation > Connection.TRANSACTION_NONE) {
+                connection.setTransactionIsolation(transactionIsolation);
+            }
             if (readWriteLock != null) {
                 if (writeLock) {
                     threadLock = readWriteLock.writeLock();
diff --git a/jdbc-storage-impl/src/test/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageServiceTest.java b/jdbc-storage-impl/src/test/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageServiceTest.java
index 833f5ba..80ea28e 100644
--- a/jdbc-storage-impl/src/test/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageServiceTest.java
+++ b/jdbc-storage-impl/src/test/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageServiceTest.java
@@ -128,6 +128,7 @@ public class JDBCStorageServiceTest extends StorageServiceTest {
             storageService = new JDBCStorageService();
             storageService.setId("test");
             storageService.setDataSource(ds);
+            storageService.setTransactionIsolation(Connection.TRANSACTION_NONE);
             final Duration fiveSecs = Duration.ofSeconds(5);
             assert fiveSecs!=null;
             storageService.setCleanupInterval(fiveSecs);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list