adutra commented on PR #1765:
URL: https://github.com/apache/polaris/pull/1765#issuecomment-2932100462
@adnanhemani thanks for bringing my attention to this PR.
> I realized that due to the Supplier's lazy-loading [...] the .get() was
actually using a RequestScoped realmContext bean given by the previously-ran
TokenBroker initialization
Hmm I looked at your code snippets but I don't see the connection between
the `TokenBroker` bean production and the lazy loading of
`JdbcBasePersistenceImpl`. But assuming that this is happening inside a task
executor thread, and the problem is `RealmContext`, why don't you resolve the
realmId eagerly? E.g.:
```java
private void initializeForRealm(
RealmContext realmContext, RootCredentialsSet rootCredentialsSet,
boolean isBootstrap) {
String realmId = realmContext.getRealmIdentifier(); // resolve realm ID
eagerly
DatasourceOperations databaseOperations =
getDatasourceOperations(isBootstrap);
sessionSupplierMap.put(
realmId,
() ->
new JdbcBasePersistenceImpl(
databaseOperations,
secretsGenerator(() -> realmId, rootCredentialsSet),
storageIntegrationProvider,
realmId));
PolarisMetaStoreManager metaStoreManager = createNewMetaStoreManager();
metaStoreManagerMap.put(realmId, metaStoreManager);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]