felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1696530 - /felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
Date Wed, 19 Aug 2015 07:52:55 GMT
Author: gnodet
Date: Wed Aug 19 07:52:55 2015
New Revision: 1696530

URL: http://svn.apache.org/r1696530
Log:
[FELIX-4988] ResolverImpl uses an internal ExecutorService

Modified:
    felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java

Modified: felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java?rev=1696530&r1=1696529&r2=1696530&view=diff
==============================================================================
--- felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java (original)
+++ felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java Wed Aug
19 07:52:55 2015
@@ -60,6 +60,8 @@ public class ResolverImpl implements Res
 
     private final int m_parallelism;
 
+    private final Executor m_executor;
+
     // Note this class is not thread safe.
     // Only use in the context of a single thread.
     class ResolveSession
@@ -114,16 +116,28 @@ public class ResolverImpl implements Res
     {
         this.m_logger = logger;
         this.m_parallelism = parallelism;
+        this.m_executor = null;
+    }
+
+    public ResolverImpl(Logger logger, Executor executor)
+    {
+        this.m_logger = logger;
+        this.m_parallelism = -1;
+        this.m_executor = executor;
     }
 
     public Map<Resource, List<Wire>> resolve(ResolveContext rc) throws ResolutionException
     {
-        if (m_parallelism > 1)
+        if (m_executor != null)
+        {
+            return resolve(rc, m_executor);
+        }
+        else if (m_parallelism > 1)
         {
             ExecutorService executor = Executors.newFixedThreadPool(m_parallelism);
             try
             {
-                return doResolve(rc, executor);
+                return resolve(rc, executor);
             }
             finally
             {
@@ -132,11 +146,11 @@ public class ResolverImpl implements Res
         }
         else
         {
-            return doResolve(rc, new DumbExecutor());
+            return resolve(rc, new DumbExecutor());
         }
     }
 
-    private Map<Resource, List<Wire>> doResolve(ResolveContext rc, Executor executor)
throws ResolutionException
+    public Map<Resource, List<Wire>> resolve(ResolveContext rc, Executor executor)
throws ResolutionException
     {
         ResolveSession session = new ResolveSession(rc);
         Map<Resource, List<Wire>> wireMap =



Mime
View raw message