You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/11/21 06:15:43 UTC

[GitHub] [zookeeper] maoling commented on a change in pull request #1544: ZOOKEEPER-4010:ProviderRegistry.initialized is not volatile

maoling commented on a change in pull request #1544:
URL: https://github.com/apache/zookeeper/pull/1544#discussion_r528079764



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/auth/ProviderRegistry.java
##########
@@ -31,7 +31,7 @@
 
     public static final String AUTHPROVIDER_PROPERTY_PREFIX = "zookeeper.authProvider.";
 
-    private static boolean initialized = false;
+    private static volatile boolean initialized = false;
     private static final Map<String, AuthenticationProvider> authenticationProviders = new HashMap<>();
 

Review comment:
       Look at the call/write of `initialized`, `reset()` is only used for testing, and `initialize()` is used at the start-up of server. so we don't have the situation when `initialized` is visited by multi-threads, one thread changes the value and it should be visible at once for other threads?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org