diff --git a/pom.xml b/pom.xml
index d6479d9..a6f85e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.amazonaws.secretsmanager
aws-secretsmanager-caching-java
- 2.0.1
+ 2.1.0
jar
@@ -37,17 +37,14 @@
- 8
- 1.8
- 1.8
- UTF-8
+ UTF-8
software.amazon.awssdk
secretsmanager
- 2.29.6
+ 2.37.1
org.testng
@@ -58,13 +55,13 @@
org.mockito
mockito-core
- 5.17.0
+ 5.20.0
test
com.github.spotbugs
spotbugs-annotations
- 4.8.6
+ 4.9.8
compile
@@ -73,10 +70,9 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.13.0
+ 3.14.1
- 1.8
- 1.8
+ 8
-Xlint:all
true
true
@@ -98,7 +94,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.11.1
+ 3.12.0
attach-javadocs
@@ -132,7 +128,7 @@
com.github.spotbugs
spotbugs-maven-plugin
- 4.8.6.5
+ 4.9.8.1
Max
Low
@@ -152,7 +148,7 @@
org.jacoco
jacoco-maven-plugin
- 0.8.12
+ 0.8.14
prepare-agent
@@ -169,26 +165,6 @@
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 3.8.1
-
-
-
- properties
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 3.5.2
-
- @{argLine} -javaagent:${org.mockito:mockito-core:jar}
-
-
@@ -200,7 +176,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 3.2.7
+ 3.2.8
sign-artifacts
@@ -214,7 +190,7 @@
org.sonatype.central
central-publishing-maven-plugin
- 0.7.0
+ 0.9.0
true
central
diff --git a/src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheObject.java b/src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheObject.java
index 3d626c4..ab9632b 100644
--- a/src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheObject.java
+++ b/src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheObject.java
@@ -14,6 +14,7 @@
package com.amazonaws.secretsmanager.caching.cache;
import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
import com.amazonaws.secretsmanager.caching.SecretCacheConfiguration;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -50,7 +51,7 @@ public abstract class SecretCacheObject {
protected final SecretCacheConfiguration config;
/** A flag to indicate a refresh is needed. */
- private boolean refreshNeeded = true;
+ private final AtomicBoolean refreshNeeded = new AtomicBoolean(true);
/** The result of the last AWS Secrets Manager request for this item. */
private Object data = null;
@@ -145,7 +146,9 @@ private void setResult(T result) {
* @return True if the secret item should be refreshed.
*/
protected boolean isRefreshNeeded() {
- if (this.refreshNeeded) { return true; }
+ if (this.refreshNeeded.get()) {
+ return true;
+ }
if (null != this.exception) {
// If we encountered an exception on the last attempt
// we do not want to keep retrying without a pause between
@@ -168,7 +171,7 @@ protected boolean isRefreshNeeded() {
*/
private void refresh() {
if (!this.isRefreshNeeded()) { return; }
- this.refreshNeeded = false;
+ this.refreshNeeded.set(false);
try {
this.setResult(this.executeRefresh());
this.exception = null;
@@ -204,7 +207,7 @@ private void refresh() {
* If the thread is interrupted while waiting for the refresh.
*/
public boolean refreshNow() throws InterruptedException {
- this.refreshNeeded = true;
+ this.refreshNeeded.set(true);
// When forcing a refresh, always sleep with a random jitter
// to prevent coding errors that could be calling refreshNow
// in a loop.
@@ -235,6 +238,7 @@ public boolean refreshNow() throws InterruptedException {
*
* @return The cached GetSecretValue result.
*/
+ @SuppressFBWarnings("THROWS_METHOD_THROWS_RUNTIMEEXCEPTION")
public GetSecretValueResponse getSecretValue() {
synchronized (lock) {
refresh();
diff --git a/src/main/java/com/amazonaws/secretsmanager/caching/cache/internal/VersionInfo.java b/src/main/java/com/amazonaws/secretsmanager/caching/cache/internal/VersionInfo.java
index d0fa0a9..116f01b 100644
--- a/src/main/java/com/amazonaws/secretsmanager/caching/cache/internal/VersionInfo.java
+++ b/src/main/java/com/amazonaws/secretsmanager/caching/cache/internal/VersionInfo.java
@@ -18,17 +18,14 @@
* client.
*/
public class VersionInfo {
- public static final String VERSION_NUM = "2";
- // incremented for design changes that break backward compatibility.
- public static final String MAJOR_REVISION_NUM = VERSION_NUM;
- // incremented for minor changes to the implementation
- public static final String MINOR_REVISION_NUM = "0";
- // incremented for releases containing an immediate bug fix.
- public static final String BUGFIX_REVISION_NUM = "0";
-
- public static final String RELEASE_VERSION = MAJOR_REVISION_NUM + "." + MINOR_REVISION_NUM
- + "." + BUGFIX_REVISION_NUM;
+ /**
+ * Library version number
+ */
+ public static final String RELEASE_VERSION = "2.1.0";
+ /**
+ * User agent for AWS Secrets Manager API calls.
+ */
public static final String USER_AGENT = "AwsSecretCache/" + RELEASE_VERSION;
private VersionInfo() {