jerqi commented on code in PR #7062:
URL: https://github.com/apache/gravitino/pull/7062#discussion_r2061964922


##########
server-common/src/main/java/org/apache/gravitino/server/authorization/GravitinoAuthorizerProvider.java:
##########
@@ -40,7 +41,21 @@ private GravitinoAuthorizerProvider() {}
    * @param serverConfig Gravitino server config
    */
   public void initialize(ServerConfig serverConfig) {
-    // TODO
+    if (gravitinoAuthorizer == null) {
+      synchronized (this) {
+        if (gravitinoAuthorizer == null) {
+          boolean enableAuthorization = 
serverConfig.get(Configs.ENABLE_AUTHORIZATION);
+          if (enableAuthorization) {
+            // TODO
+          } else {
+            gravitinoAuthorizer = new IgnoreAuthorizer();
+          }
+        }
+      }
+    }
+    if (gravitinoAuthorizer != null) {

Review Comment:
   This should be protected by the lock, too. Otherwise, it may be initialize 
multiple times.



##########
server-common/src/main/java/org/apache/gravitino/server/authorization/GravitinoAuthorizerProvider.java:
##########
@@ -40,7 +41,21 @@ private GravitinoAuthorizerProvider() {}
    * @param serverConfig Gravitino server config
    */
   public void initialize(ServerConfig serverConfig) {
-    // TODO
+    if (gravitinoAuthorizer == null) {
+      synchronized (this) {
+        if (gravitinoAuthorizer == null) {
+          boolean enableAuthorization = 
serverConfig.get(Configs.ENABLE_AUTHORIZATION);
+          if (enableAuthorization) {
+            // TODO
+          } else {
+            gravitinoAuthorizer = new IgnoreAuthorizer();
+          }
+        }
+      }
+    }
+    if (gravitinoAuthorizer != null) {

Review Comment:
   This should be protected by the lock, too. Otherwise, it may be initialized 
multiple times.



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

Reply via email to