brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [05/50] brooklyn-server git commit: Update call to ServiceLoader.load to match previous call pattern.
Date Wed, 30 Mar 2016 13:59:42 GMT
Update call to ServiceLoader.load to match previous call pattern.

(Previous in the sense of prior to the FrameworkLookup change.)


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

Branch: refs/heads/master
Commit: afcb689f0a31995a27c953abab73f4902d8f2754
Parents: 6c3c508
Author: Geoff Macartney <geoff.macartney@cloudsoftcorp.com>
Authored: Wed Mar 16 12:43:38 2016 +0000
Committer: Geoff Macartney <geoff.macartney@cloudsoftcorp.com>
Committed: Wed Mar 16 12:43:38 2016 +0000

----------------------------------------------------------------------
 .../org/apache/brooklyn/api/framework/FrameworkLookup.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/afcb689f/api/src/main/java/org/apache/brooklyn/api/framework/FrameworkLookup.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/framework/FrameworkLookup.java b/api/src/main/java/org/apache/brooklyn/api/framework/FrameworkLookup.java
index 32922b6..3dbe64f 100644
--- a/api/src/main/java/org/apache/brooklyn/api/framework/FrameworkLookup.java
+++ b/api/src/main/java/org/apache/brooklyn/api/framework/FrameworkLookup.java
@@ -111,9 +111,12 @@ public class FrameworkLookup {
         return result;
     }
 
-    private static <T> Iterable<T> lookupAllViaServiceLoader(Class<T> clazz,
ClassLoader loader) {
+    private static <T> ServiceLoader<T> lookupAllViaServiceLoader(Class<T>
clazz, ClassLoader loader) {
         LOG.debug("Looking up all " + clazz.getSimpleName() + "  via ServiceLoader");
 
+        if (null == loader) {
+            return ServiceLoader.load(clazz);
+        }
         return ServiceLoader.load(clazz, loader);
     }
 
@@ -134,7 +137,7 @@ public class FrameworkLookup {
         LOG.debug("Looking up " + clazz.getSimpleName() + "  via ServiceLoader");
 
         Maybe<T> result = Maybe.absent("No class " + clazz.getSimpleName() + " found
with ServiceLoader");
-        ServiceLoader<T> LOADER = ServiceLoader.load(clazz, loader);
+        ServiceLoader<T> LOADER = lookupAllViaServiceLoader(clazz, loader);
         for (T item : LOADER) {
             return Maybe.of(item);
         }


Mime
View raw message