File tree Expand file tree Collapse file tree
google-auth-library-java/oauth2_http/java/com/google/auth/oauth2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ final class RegionalAccessBoundary implements Serializable {
6969 static final long TTL_MILLIS = 6 * 60 * 60 * 1000L ; // 6 hours
7070 static final long REFRESH_THRESHOLD_MILLIS = 1 * 60 * 60 * 1000L ; // 1 hour
7171
72- private static MtlsUtils .MtlsEndpointUsagePolicy userMtlsPolicy = null ;
72+ private static volatile MtlsUtils .MtlsEndpointUsagePolicy userMtlsPolicy = null ;
7373
7474 private final String encodedLocations ;
7575 private final List <String > locations ;
@@ -193,8 +193,12 @@ static RegionalAccessBoundary refresh(
193193 }
194194
195195 if (userMtlsPolicy == null ) {
196- userMtlsPolicy =
197- MtlsUtils .getMtlsEndpointUsagePolicy (SystemEnvironmentProvider .getInstance ());
196+ synchronized (RegionalAccessBoundary .class ) {
197+ if (userMtlsPolicy == null ) {
198+ userMtlsPolicy =
199+ MtlsUtils .getMtlsEndpointUsagePolicy (SystemEnvironmentProvider .getInstance ());
200+ }
201+ }
198202 }
199203 if (transportFactory instanceof com .google .auth .mtls .MtlsHttpTransportFactory
200204 || userMtlsPolicy == MtlsUtils .MtlsEndpointUsagePolicy .ALWAYS ) {
You can’t perform that action at this time.
0 commit comments