dimas-b commented on code in PR #1816: URL: https://github.com/apache/polaris/pull/1816#discussion_r2129116394
########## polaris-core/src/main/java/org/apache/polaris/core/PolarisCallContext.java: ########## @@ -94,4 +94,17 @@ public RealmContext getRealmContext() { public PolarisCallContext getPolarisCallContext() { return this; } + + @Override + public CallContext copy() { + // The realm context is a request scoped bean injected by CDI, + // which will be closed after the http request. This copy is currently + // only used by TaskExecutor right before the task is handled, since the + // task is executed outside the active request scope, we need to make a + // copy of the RealmContext to ensure the access during the task executor. + String realmId = this.realmContext.getRealmIdentifier(); + RealmContext realmContext = () -> realmId; + return new PolarisCallContext( + realmContext, this.metaStore, this.diagServices, this.configurationStore, this.clock); Review Comment: Veering away from `@Singleton`. I'd like to avoid copying / cloning contexts completely and rely on CDI for injection in Quarkus. The open question here is how to deal with custom downstream builds that use `polaris-core` classes directly. I hope we can refactor that to allow for reuse via constructors and factories. -- 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: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org