@@ -64,7 +64,7 @@ final class RegionalAccessBoundaryManager {
6464 * The default maximum elapsed time in milliseconds for retrying Regional Access Boundary lookup
6565 * requests.
6666 */
67- private static final int DEFAULT_MAX_RETRY_ELAPSED_TIME_MILLIS = 60000 ;
67+ static final int DEFAULT_MAX_RETRY_ELAPSED_TIME_MILLIS = 60000 ;
6868
6969 /**
7070 * cachedRAB uses AtomicReference to provide thread-safe, lock-free access to the cached data for
@@ -94,7 +94,7 @@ final class RegionalAccessBoundaryManager {
9494 private static final int EXECUTOR_POOL_SIZE = 5 ;
9595 private static final int EXECUTOR_QUEUE_CAPACITY = 100 ;
9696
97- private static final ExecutorService EXECUTOR ;
97+ private static final ExecutorService DEFAULT_SHARED_EXECUTOR ;
9898
9999 static {
100100 ThreadPoolExecutor executor =
@@ -112,25 +112,33 @@ final class RegionalAccessBoundaryManager {
112112 // Allow core threads to time out so the executor can shrink to 0 when idle.
113113 // Ensures threads are released when idle to avoid unnecessary resource usage.
114114 executor .allowCoreThreadTimeOut (true );
115- EXECUTOR = executor ;
115+ DEFAULT_SHARED_EXECUTOR = executor ;
116116 }
117117
118118 private final transient Clock clock ;
119119 private final int maxRetryElapsedTimeMillis ;
120+ private final ExecutorService executor ;
120121
121122 /**
122123 * Creates a new RegionalAccessBoundaryManager with the default retry timeout of 60 seconds.
123124 *
124125 * @param clock The clock to use for cooldown and expiration checks.
125126 */
126127 RegionalAccessBoundaryManager (Clock clock ) {
127- this (clock , DEFAULT_MAX_RETRY_ELAPSED_TIME_MILLIS );
128+ this (clock , DEFAULT_MAX_RETRY_ELAPSED_TIME_MILLIS , DEFAULT_SHARED_EXECUTOR );
128129 }
129130
130131 @ VisibleForTesting
131132 RegionalAccessBoundaryManager (Clock clock , int maxRetryElapsedTimeMillis ) {
133+ this (clock , maxRetryElapsedTimeMillis , DEFAULT_SHARED_EXECUTOR );
134+ }
135+
136+ @ VisibleForTesting
137+ RegionalAccessBoundaryManager (
138+ Clock clock , int maxRetryElapsedTimeMillis , ExecutorService executor ) {
132139 this .clock = clock != null ? clock : Clock .SYSTEM ;
133140 this .maxRetryElapsedTimeMillis = maxRetryElapsedTimeMillis ;
141+ this .executor = executor ;
134142 }
135143
136144 /**
@@ -203,12 +211,15 @@ void triggerAsyncRefresh(
203211 };
204212
205213 try {
206- EXECUTOR .submit (refreshTask );
214+ this . executor .submit (refreshTask );
207215 } catch (Exception | Error e ) {
208216 // If scheduling fails (e.g., RejectedExecutionException, OutOfMemoryError for threads),
209217 // the task's finally block will never execute. We must release the lock here.
210- handleRefreshFailure (
211- new Exception ("Regional Access Boundary background refresh failed to schedule" , e ));
218+ LoggingUtils .log (
219+ LOGGER_PROVIDER ,
220+ java .util .logging .Level .WARNING ,
221+ null ,
222+ "Regional Access Boundary background refresh failed to schedule: " + e .getMessage ());
212223 future .setException (e );
213224 refreshFuture .set (null );
214225 }
0 commit comments