flyrain commented on code in PR #1758:
URL: https://github.com/apache/polaris/pull/1758#discussion_r2121824015


##########
polaris-core/src/main/java/org/apache/polaris/core/config/PolarisConfigurationStore.java:
##########
@@ -57,14 +62,48 @@ public interface PolarisConfigurationStore {
    * @param defaultValue the default value if the configuration key has no 
value
    * @return the current value or the supplied default value
    * @param <T> the type of the configuration value
+   * @deprecated this function is going to be deprecated, please use the 
following function to get
+   *     the configuration value in a more robust way: getConfiguration(String 
realm, String
+   *     configName, @Nonnull T defaultValue) This function can not be called 
outside of active
+   *     request scope, such as background tasks (TaskExecutor).
    */
+  @Deprecated
   default <T> @Nonnull T getConfiguration(
       PolarisCallContext ctx, String configName, @Nonnull T defaultValue) {
     Preconditions.checkNotNull(defaultValue, "Cannot pass null as a default 
value");
     T configValue = getConfiguration(ctx, configName);
     return configValue != null ? configValue : defaultValue;
   }
 
+  /**
+   * Retrieve the current value for a configuration key for a given realm. May 
be null if not set.
+   *
+   * @param realm the realm identifier
+   * @param configName the name of the configuration key to check
+   * @return the current value set for the configuration key for the given 
realm, or null if not set
+   * @param <T> the type of the configuration value
+   */
+  default <T> @Nullable T getConfiguration(String realm, String configName) {

Review Comment:
   I'd like to see this happen, if all we need here is actually the `realm`. 
This largely simplify the interface, which also avoid any complication of CDI. 
Also all callers of `getConfiguration()` will have the `realm` ready to pass 
in. 
   
   A side note: why would a new method have to be the same with other methods 
for its parameters? 



-- 
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

Reply via email to