You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/09/05 02:22:23 UTC

[GitHub] [lucene-solr] gus-asf commented on a change in pull request #838: SOLR-13705 Double-checked locking bug is fixed.

gus-asf commented on a change in pull request #838: SOLR-13705 Double-checked locking bug is fixed.
URL: https://github.com/apache/lucene-solr/pull/838#discussion_r321050422
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandler.java
 ##########
 @@ -260,22 +260,25 @@ public String toString() {
 
   @Override
   public Collection<Api> getApis() {
-    if (apis == null) {
+    Collection<Api> syncedApis = apis;
+    if (syncedApis == null) {
       synchronized (this) {
-        if (apis == null) {
-          Collection<Api> apis = new ArrayList<>();
+        syncedApis = apis;
+        if (syncedApis == null) {
+          syncedApis = new ArrayList<>();
+          apis = syncedApis;
 
 Review comment:
   Is this correct? Doesn't this line assigning syncedApis to apis expose the partially configured empty list to the rest of the world as a non-immutable collection while the rest of this method executes (which was the original complaint)? I think without this line the patch is an improvement...(the existing code has this problem too).

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org