felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1620566 - in /felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager: Activator.java ParallelActivator.java
Date Tue, 26 Aug 2014 11:01:50 GMT
Author: pderop
Date: Tue Aug 26 11:01:50 2014
New Revision: 1620566

URL: http://svn.apache.org/r1620566
Log:
Register a threadpool in the service registry, when using parallel DM.

Modified:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/Activator.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/ParallelActivator.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/Activator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/Activator.java?rev=1620566&r1=1620565&r2=1620566&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/Activator.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/Activator.java
Tue Aug 26 11:01:50 2014
@@ -22,6 +22,7 @@ import org.apache.felix.dm.benchmark.sce
 import org.apache.felix.dm.benchmark.scenario.impl.ArtistImpl;
 import org.apache.felix.dm.benchmark.scenario.impl.TrackImpl;
 import org.osgi.framework.BundleContext;
+import java.util.concurrent.Executor;
 
 /**
  * Activator for a scenario based on Dependency Manager 4.0
@@ -32,26 +33,7 @@ public class Activator extends Dependenc
      * Our BenchMark controller. We only depend on it in order to not start if the controller
is not available
      */
     volatile ScenarioController m_controller;
-    
-    /**
-     * Flag used to check if our scenario can use a parallel dependency manager.
-     */
-    volatile boolean m_useThreadPool;
-        
-    /**
-     * Activator (no parallelism).
-     */
-    public Activator() {
-        this(false);
-    }
-    
-    /**
-     * Activator (possibly parallel).
-     */
-    public Activator(boolean useThreadPool) {        
-        m_useThreadPool = useThreadPool;
-    }
-        
+                    
     /**
      * First, we have to depend on the BenchmarkController service.
      */
@@ -69,11 +51,7 @@ public class Activator extends Dependenc
      */
     private void start(Component c) {
         Helper.debug(() -> "DependencyManager.Activator: start");
-
         DependencyManager dm = c.getDependencyManager();
-        if (m_useThreadPool) {
-            dm.setThreadPool(Helper.getThreadPool());
-        }
         
         List<Component> components = new ArrayList<>();
         IntStream.range(0, ARTISTS)

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/ParallelActivator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/ParallelActivator.java?rev=1620566&r1=1620565&r2=1620566&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/ParallelActivator.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/dependencymanager/ParallelActivator.java
Tue Aug 26 11:01:50 2014
@@ -1,10 +1,20 @@
 package org.apache.felix.dm.benchmark.dependencymanager;
 
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.benchmark.scenario.Helper;
+import org.osgi.framework.BundleContext;
+
 /**
  * Parallel version of our default Activator.
  */
 public class ParallelActivator extends Activator {
-    public ParallelActivator() {    
-        super(true /* use thread pool */);
+    public void start(BundleContext context) throws Exception {
+        Properties props = new Properties();
+        props.put("target", DependencyManager.THREADPOOL);
+        context.registerService(Executor.class.getName(), Helper.getThreadPool(), props);
+        super.start(context);
     }
 }



Mime
View raw message