|
@@ -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>();
|