[java-plugin-storage-jdbc] branch main updated: JJDBC-3 Align configuration with StoredIdConnection

Rod Widdowson rdw at steadingsoftware.com
Mon Jun 6 12:47:59 UTC 2022


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=8dec25f04ba0711367ad8b4e72c8e2dd3d2012ff

The following commit(s) were added to refs/heads/main by this push:
     new 8dec25f  JJDBC-3 Align configuration with StoredIdConnection
8dec25f is described below

commit 8dec25f04ba0711367ad8b4e72c8e2dd3d2012ff
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jun 6 13:45:02 2022 +0100

    JJDBC-3 Align configuration with StoredIdConnection
    
    https://shibboleth.atlassian.net/browse/JJDBC-3
    
    transactionRetry becomes transactionRetries
---
 .../storage/jdbc/impl/JDBCStorageService.java      | 26 +++++++++++-----------
 .../storage/jdbc/impl/JDBCStorageServiceTest.java  |  2 +-
 2 files changed, 14 insertions(+), 14 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 364a9f8..28874bf 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
@@ -125,7 +125,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
     @Nonnull private Duration queryTimeout = Duration.ofSeconds(5);
 
     /** How many times do we try an operation before giving up? */
-    private int transactionRetry = 3;
+    private int transactionRetries = 3;
 
     /** What transaction isolation do we want? */
     private int transactionIsolation = Connection.TRANSACTION_SERIALIZABLE;
@@ -233,11 +233,11 @@ public final class JDBCStorageService extends AbstractStorageService implements
     @Nonnull @NotEmpty private String deleteByContextSQL = DEFAULT_DELETE_BY_CONTEXT_SQL;
 
     /* Bean Setters*/
-    /** set {@link #transactionRetry}.
+    /** set {@link #transactionRetries}.
      * @param count how many time to try before we bail.
      */
-    public void setTransactionRetry(@Positive final int count) {
-        transactionRetry = count;
+    public void setTransactionRetries(@Positive final int count) {
+        transactionRetries = count;
         if (count < 0) {
             throw new ConstraintViolationException("transaction retry must be positive");
         }
@@ -284,7 +284,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
     /** What errors do we retry?
      * @param errors what to set.
      */
-    public void setRetryableErrors(@Nonnull @NonnullElements final Collection<String> errors) {
+    public void setRetryableErrors(@Nonnull @NonnullElements final List<String> errors) {
         retryableErrors = Constraint.isNotNull(errors, "errors must not be null");
         Constraint.noNullItems(errors, "errors must not have null members");
     }
@@ -526,7 +526,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
                               "create: context must not be empty");
         Constraint.isNotEmpty(Constraint.isNotNull(value, "create: value must not be null"),
                               "create: value must not be empty");
-        int retries = transactionRetry;
+        int retries = transactionRetries;
         while(true) {
             try (final ConnectionWithLock connection = new ConnectionWithLock(false, true)) {
                 log.trace("Create [Query]:: '{}'::  1: '{}' ; 2: '{}'", preCreateQuerySQL, context, key);
@@ -624,7 +624,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
         Constraint.isNotEmpty(Constraint.isNotNull(context, "read: key must not be null"),
                               "read: key must not be empty");
 
-        int retries = transactionRetry;
+        int retries = transactionRetries;
         while(true) {
             try (final ConnectionWithLock connection = new ConnectionWithLock(true, false)) {
                 final PreparedStatement stmnt = connection.prepareStatement(readRecordSQL);
@@ -739,7 +739,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
                               "update: key must not be empty");
         Constraint.isNotEmpty(Constraint.isNotNull(value, "update: value must not be null"),
                               "update: value must not be empty");
-        int retries = transactionRetry;
+        int retries = transactionRetries;
         while (true) {
             try (ConnectionWithLock connection = new ConnectionWithLock(false, true)) {
                 final PreparedStatement selectStmnt = connection.prepareStatement(preUpdateQuerySQL);
@@ -837,7 +837,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
         Constraint.isNotEmpty(Constraint.isNotNull(context, "delete: key must not be null"),
                               "delete: key must not be empty");
         Constraint.isTrue(version == null || version > 0, "delete: version should be null of > 0");
-        int retries = transactionRetry;
+        int retries = transactionRetries;
         while (true) {
             try (ConnectionWithLock connection= new ConnectionWithLock(false, true)) {
                 final PreparedStatement selectStmnt = connection.prepareStatement(preDeleteQuerySQL);
@@ -893,7 +893,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
      */
     protected void deleteImpl(@Nonnull final Long expiration) throws IOException {
         Constraint.isNotNull(expiration, "expiration: context must not be null");
-        int retries = transactionRetry;
+        int retries = transactionRetries;
         while (true) {
             try (ConnectionWithLock connection = new ConnectionWithLock(false, true)) {
                 final PreparedStatement updateStmnt = connection.prepareStatement(deleteByExpiredSQL);
@@ -929,7 +929,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
     public void reap(@Nonnull @NotEmpty final String context) throws IOException {
         Constraint.isNotEmpty(Constraint.isNotNull(context, "reap: context must not be null"),
                               "reap: context must not be empty");
-        int retries = transactionRetry;
+        int retries = transactionRetries;
         while (true) {
             try (ConnectionWithLock connection = new ConnectionWithLock(true, true)) {
                 final PreparedStatement updateStmnt = connection.prepareStatement(deleteByContextExpiredSQL);
@@ -967,7 +967,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
         throws IOException {
         Constraint.isNotEmpty(Constraint.isNotNull(context, "updateContextExpiration: context must not be null"),
                               "updateContextExpiration: context must not be empty");
-        int retries = transactionRetry;
+        int retries = transactionRetries;
         while (true) {
             try (ConnectionWithLock connection = new ConnectionWithLock(true, true)) {
                 final PreparedStatement updateStmnt = connection.prepareStatement(updateExpiresByContextSQL);
@@ -1006,7 +1006,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
     public void deleteContext(@Nonnull @NotEmpty final String context) throws IOException {
         Constraint.isNotEmpty(Constraint.isNotNull(context, "deleteContext: context must not be null"),
                               "deleteContext: context must not be empty");
-        int retries = transactionRetry;
+        int retries = transactionRetries;
         while (true) {
             try (ConnectionWithLock connection = new ConnectionWithLock(true, true)) {
                 final PreparedStatement updateStmnt = connection.prepareStatement(deleteByContextSQL);
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 9d1c83c..3928aa4 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
@@ -127,7 +127,7 @@ public class JDBCStorageServiceTest extends StorageServiceTest {
             storageService.setId("test");
             storageService.setDataSource(dataSource);
             storageService.setCleanupInterval(Duration.ofSeconds(5));
-            storageService.setTransactionRetry(12);
+            storageService.setTransactionRetries(12);
             storageService.setRetryableErrors(List.of("40001"));
             storageService.setLocalLocking(true);
         } catch (final SQLException | ClassNotFoundException e) {

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


More information about the commits mailing list