[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hadoop-commits
Subject:    hadoop git commit: HADOOP-10829. Iteration on CredentialProviderFactory.serviceLoader is thread-unsa
From:       junping_du () apache ! org
Date:       2017-08-31 23:25:29
Message-ID: af7e627763ef4bb8a8402962e2cacbcd () git ! apache ! org
[Download RAW message or body]

Repository: hadoop
Updated Branches:
  refs/heads/branch-2.8.2 8e0e71075 -> a80cd4b89


HADOOP-10829. Iteration on CredentialProviderFactory.serviceLoader is thread-unsafe. \
Contributed by Benoy Antony and Rakesh R.

(cherry picked from commit b82485d6fed2194bf0dc2eedfab7e226e30a7cf0)
(cherry picked from commit c0e294ffc82d611a64b352e3962bce9399ddbe5f)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a80cd4b8
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a80cd4b8
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a80cd4b8

Branch: refs/heads/branch-2.8.2
Commit: a80cd4b897216b8aa2bfd2f4fb5c37a545ef4503
Parents: 8e0e7107
Author: Jitendra Pandey <jitendra@apache.org>
Authored: Fri Jul 7 12:45:37 2017 -0700
Committer: Junping Du <junping_du@apache.org>
Committed: Thu Aug 31 16:23:37 2017 -0700

----------------------------------------------------------------------
 .../hadoop/security/alias/CredentialProviderFactory.java  | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/a80cd4b8/hadoop-common-project/hado \
op-common/src/main/java/org/apache/hadoop/security/alias/CredentialProviderFactory.java
                
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/CredentialProviderFactory.java \
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/CredentialProviderFactory.java
 index 3bb4f6d..1f5c8ec 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/CredentialProviderFactory.java
                
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/CredentialProviderFactory.java
 @@ -22,6 +22,7 @@ import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.ServiceLoader;
 
@@ -47,6 +48,15 @@ public abstract class CredentialProviderFactory {
   private static final ServiceLoader<CredentialProviderFactory> serviceLoader =
       ServiceLoader.load(CredentialProviderFactory.class);
 
+  // Iterate through the serviceLoader to avoid lazy loading.
+  // Lazy loading would require synchronization in concurrent use cases.
+  static {
+    Iterator<CredentialProviderFactory> iterServices = serviceLoader.iterator();
+    while (iterServices.hasNext()) {
+      iterServices.next();
+    }
+  }
+
   public static List<CredentialProvider> getProviders(Configuration conf
                                                ) throws IOException {
     List<CredentialProvider> result = new ArrayList<CredentialProvider>();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic