Skip to content

Commit 167459d

Browse files
authored
Don't re-use STS Client Builder across threads (#82)
* don't re-use builder across threads * style
1 parent 31c8616 commit 167459d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

polaris-service/src/main/java/io/polaris/service/PolarisApplication.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,17 @@ public void run(PolarisApplicationConfig configuration, Environment environment)
144144
// PolarisEntityManager will be used for Management APIs and optionally the core Catalog APIs
145145
// depending on the value of the baseCatalogType config.
146146
MetaStoreManagerFactory metaStoreManagerFactory = configuration.getMetaStoreManagerFactory();
147-
StsClientBuilder stsClientBuilder = StsClient.builder();
148-
AwsCredentialsProvider awsCredentialsProvider = configuration.credentialsProvider();
149-
if (awsCredentialsProvider != null) {
150-
stsClientBuilder.credentialsProvider(awsCredentialsProvider);
151-
}
147+
152148
metaStoreManagerFactory.setStorageIntegrationProvider(
153-
new PolarisStorageIntegrationProviderImpl(stsClientBuilder::build));
149+
new PolarisStorageIntegrationProviderImpl(
150+
() -> {
151+
StsClientBuilder stsClientBuilder = StsClient.builder();
152+
AwsCredentialsProvider awsCredentialsProvider = configuration.credentialsProvider();
153+
if (awsCredentialsProvider != null) {
154+
stsClientBuilder.credentialsProvider(awsCredentialsProvider);
155+
}
156+
return stsClientBuilder.build();
157+
}));
154158

155159
PolarisMetricRegistry polarisMetricRegistry =
156160
new PolarisMetricRegistry(new PrometheusMeterRegistry(PrometheusConfig.DEFAULT));

0 commit comments

Comments
 (0)