Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit bf3aec5

Browse files
Update to use AtomicReference
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 7db9a6c commit bf3aec5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

samples/snippets/src/main/java/com/example/spanner/MutableCredentialsExample.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ public class MutableCredentialsExample {
3939
static void createClientWithMutableCredentials() throws IOException {
4040
final String credentialsPath = "location_of_service_account_credential_json";
4141
Path path = Paths.get(credentialsPath);
42-
// Use an array to hold the mutable lastModifiedTime so it can be accessed in the lambda
43-
FileTime[] lastModifiedTime = new FileTime[] {Files.getLastModifiedTime(path)};
42+
// Use an AtomicReference to hold the mutable lastModifiedTime so it can be accessed in the lambda
43+
final java.util.concurrent.atomic.AtomicReference<FileTime> lastModifiedTime =
44+
new java.util.concurrent.atomic.AtomicReference<>(Files.getLastModifiedTime(path));
4445

4546
// 1 - create service account credentials
4647
ServiceAccountCredentials serviceAccountCredentials;

0 commit comments

Comments
 (0)