From d544e369f03096fe4cb4c146bd04983b3b318b8f Mon Sep 17 00:00:00 2001 From: emmyzhou-db Date: Tue, 17 Jun 2025 22:34:51 +0000 Subject: [PATCH 1/2] Read from env var when creating refreshabletokensource --- .../com/databricks/sdk/core/oauth/RefreshableTokenSource.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/RefreshableTokenSource.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/RefreshableTokenSource.java index d84f6de96..c4afd0859 100644 --- a/databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/RefreshableTokenSource.java +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/RefreshableTokenSource.java @@ -45,7 +45,8 @@ protected enum TokenState { // The current OAuth token. May be null if not yet fetched. protected volatile Token token; // Whether asynchronous refresh is enabled. - private boolean asyncEnabled = false; + private boolean asyncEnabled = + Boolean.parseBoolean(System.getenv("DATABRICKS_ENABLE_EXPERIMENTAL_ASYNC_TOKEN_REFRESH")); // Duration before expiry to consider a token as 'stale'. private Duration staleDuration = DEFAULT_STALE_DURATION; // Additional buffer before expiry to consider a token as expired. From a1ac804c17f4fe83f17f759db1b610aaefd9a6a0 Mon Sep 17 00:00:00 2001 From: emmyzhou-db Date: Tue, 17 Jun 2025 22:45:24 +0000 Subject: [PATCH 2/2] Update changelog --- NEXT_CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 34a0d9f1c..413628a39 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -3,7 +3,12 @@ ## Release v0.54.0 ### New Features and Improvements - +* [Experimental] Add support for asynchronous token refresh ([#464](https://github.com/databricks/databricks-sdk-java/pull/465)). + Enable this feature by setting the environment variable: + ```bash + export DATABRICKS_ENABLE_EXPERIMENTAL_ASYNC_TOKEN_REFRESH=true + ``` + Note: This feature and its configuration are experimental and may be removed in future releases. ### Bug Fixes ### Documentation