Skip to content

Commit b46e9bf

Browse files
committed
Addressed Gemini bot comments.
1 parent 93bb045 commit b46e9bf

15 files changed

+24
-487
lines changed

google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java.rej

Lines changed: 0 additions & 26 deletions
This file was deleted.

google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java.rej

Lines changed: 0 additions & 17 deletions
This file was deleted.

google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,10 +581,7 @@ Map<String, List<String>> addRegionalAccessBoundaryToRequestMetadata(
581581

582582
@Override
583583
protected Map<String, List<String>> getAdditionalHeaders() {
584-
Map<String, List<String>> headers = new HashMap<>(super.getAdditionalHeaders());
585-
586-
String quotaProjectId = this.getQuotaProjectId();
587-
return addQuotaProjectIdToRequestMetadata(quotaProjectId, headers);
584+
return addQuotaProjectIdToRequestMetadata(getQuotaProjectId(), super.getAdditionalHeaders());
588585
}
589586

590587
/** Default constructor. */

google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ImpersonatedCredentials.java.rej

Lines changed: 0 additions & 18 deletions
This file was deleted.

google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/RegionalAccessBoundaryManager.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@
3838
import com.google.common.util.concurrent.SettableFuture;
3939
import java.util.concurrent.ExecutorService;
4040
import java.util.concurrent.Executors;
41+
import java.util.concurrent.LinkedBlockingQueue;
42+
import java.util.concurrent.SynchronousQueue;
4143
import java.util.concurrent.ThreadFactory;
44+
import java.util.concurrent.ThreadPoolExecutor;
45+
import java.util.concurrent.TimeUnit;
4246
import java.util.concurrent.atomic.AtomicReference;
4347
import java.util.logging.Level;
4448
import javax.annotation.Nullable;
@@ -55,16 +59,33 @@ final class RegionalAccessBoundaryManager {
5559
private static final LoggerProvider LOGGER_PROVIDER =
5660
LoggerProvider.forClazz(RegionalAccessBoundaryManager.class);
5761

62+
private static final int CORE_POOL_SIZE = 0;
63+
private static final int MAX_POOL_SIZE = 100;
64+
private static final long KEEP_ALIVE_TIME_SECONDS = 60L;
65+
private static final int QUEUE_CAPACITY = 100;
66+
67+
/**
68+
* Globally shared bounded thread pool across all independent credential instances to protect JVM native
69+
* thread limits and avoid the risks of unbounded thread pools. Uses a finite delay queue to hold parallel
70+
* expiration bursts. If concurrency exceeds the capacity of MAX_POOL_SIZE + QUEUE_CAPACITY, tasks are
71+
* instantly rejected and the specific credential instance enters backoff cooldown.
72+
*/
5873
private static final ExecutorService REFRESH_EXECUTOR =
59-
Executors.newCachedThreadPool(
74+
new ThreadPoolExecutor(
75+
CORE_POOL_SIZE,
76+
MAX_POOL_SIZE,
77+
KEEP_ALIVE_TIME_SECONDS,
78+
TimeUnit.SECONDS,
79+
new LinkedBlockingQueue<>(QUEUE_CAPACITY),
6080
new ThreadFactory() {
6181
@Override
6282
public Thread newThread(Runnable r) {
6383
Thread t = new Thread(r, "RAB-refresh-thread");
6484
t.setDaemon(true);
6585
return t;
6686
}
67-
});
87+
},
88+
new ThreadPoolExecutor.AbortPolicy());
6889

6990
static final long INITIAL_COOLDOWN_MILLIS = 15 * 60 * 1000L; // 15 minutes
7091
static final long MAX_COOLDOWN_MILLIS = 6 * 60 * 60 * 1000L; // 6 hours

google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/AwsCredentialsTest.java.rej

Lines changed: 0 additions & 16 deletions
This file was deleted.

google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/ComputeEngineCredentialsTest.java.rej

Lines changed: 0 additions & 75 deletions
This file was deleted.

google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentialsTest.java.rej

Lines changed: 0 additions & 71 deletions
This file was deleted.

google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java.rej

Lines changed: 0 additions & 42 deletions
This file was deleted.

google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/GoogleCredentialsTest.java.rej

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)