felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1626906 - /felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/TestBase.java
Date Mon, 22 Sep 2014 21:58:19 GMT
Author: pderop
Date: Mon Sep 22 21:58:18 2014
New Revision: 1626906

URL: http://svn.apache.org/r1626906
Log:
Register a threadpool in the OSGi registry, when a test should run in parallel.

Modified:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/TestBase.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/TestBase.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/TestBase.java?rev=1626906&r1=1626905&r2=1626906&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/TestBase.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/TestBase.java
Mon Sep 22 21:58:18 2014
@@ -4,6 +4,7 @@ import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Hashtable;
 import java.util.List;
+import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -46,6 +47,9 @@ public abstract class TestBase extends T
     // Our dependency manager used to create test components.
     protected volatile DependencyManager m_dm;
 
+    // The Registration for the DM threadpool.
+    private ServiceRegistration m_threadPoolRegistration;
+
     public TestBase() {
     }
        
@@ -61,7 +65,9 @@ public abstract class TestBase extends T
         m_dm = new DependencyManager(context);
         if (m_parallel) {
             warn("Using threadpool ...");
-            m_dm.setThreadPool(m_threadPool);
+            Hashtable props = new Hashtable();
+            props.put("target", DependencyManager.THREADPOOL);
+            m_threadPoolRegistration = context.registerService(Executor.class.getName(),
m_threadPool, props);
         }
     }
     
@@ -69,6 +75,9 @@ public abstract class TestBase extends T
     	warn("Tearing down test " + getClass().getName());
     	logService.unregister();
     	context.removeFrameworkListener(this);
+    	if (m_threadPoolRegistration != null) {
+    	    m_threadPoolRegistration.unregister();
+    	}
     	clearComponents();
     }
         



Mime
View raw message