You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2014/11/23 16:33:14 UTC

svn commit: r1641202 - /felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java

Author: pderop
Date: Sun Nov 23 15:33:14 2014
New Revision: 1641202

URL: http://svn.apache.org/r1641202
Log:
no need to register/unregister the ScenarioController service each time the tested bundles are restarted. Increased start/stop loop to 50. Don't make some processing in component stop methods

Modified:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java?rev=1641202&r1=1641201&r2=1641202&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java Sun Nov 23 15:33:14 2014
@@ -86,10 +86,13 @@ public class ScenarioControllerImpl impl
             bundle.stop();
         }));
         
+        // Register our controller service
+        m_bctx.registerService(ScenarioController.class.getName(), this, null);
+        
         // Start/stop several times the tested bundles. (no processing done in components start/stop methods).
         m_doProcessingInStartStop = false;
         out.println("\n\t[Starting benchmarks with no processing done in components start/stop methods]");
-        startStopScenarioBundles(TESTS, 20);
+        startStopScenarioBundles(TESTS, 50);
        
         // Start/stop several times the tested bundles (processing is done in components start/stop methods).
         m_doProcessingInStartStop = true;
@@ -190,7 +193,7 @@ public class ScenarioControllerImpl impl
     }
 
     private void componentRemoved() {
-        doProcessing();
+        //doProcessing();
         m_stopLatch.countDown();
     }
 
@@ -220,8 +223,7 @@ public class ScenarioControllerImpl impl
      * 
      * 1) start a bundle, and register the ScenarioController service (this will trigger all components activation)
      * 2) wait for all expected components to be fully started
-     * 3) unregister our ScenarioController service, and wait for all expected components to be fully stopped
-     * 4) stop the bundle
+     * 3) stop the bundle and wait for all expected components to be fully stopped
      * 
      * @param b the benchmarked scenario bundle
      */
@@ -229,9 +231,6 @@ public class ScenarioControllerImpl impl
         try {
             initLatches();
 
-            // Register our controller service
-            ServiceRegistration controller = m_bctx.registerService(ScenarioController.class.getName(), this, null);
-            
             debug(() -> "starting bundle " + b.getSymbolicName());
             b.start();
                                     
@@ -239,21 +238,15 @@ public class ScenarioControllerImpl impl
                 out.println("Could not start components timely: current start latch=" + m_startLatch.getCount() + ", stop latch=" + m_stopLatch.getCount());
                 Unchecked.run(() -> Thread.sleep(Integer.MAX_VALUE));
             }
+                        
+            debug(() -> "stopping bundle " + b.getSymbolicName());
+            b.stop();
             
-            // Unregister our controller service (this will deactivate all components)
-            controller.unregister();
-
             // Wait for all component deactivations
             if (! m_stopLatch.await(60, TimeUnit.SECONDS)) {
                 out.println("Could not stop components timely: current start latch=" + m_startLatch.getCount() + ", stop latch=" + m_stopLatch.getCount());
                 Unchecked.run(() -> Thread.sleep(Integer.MAX_VALUE));
-            }
-
-            debug(() -> "stopping bundle " + b.getSymbolicName());
-            b.stop();            
-            
-            // Make sure all pending tasks in the threadpool have been fully executed, before restarting a new test
-            Helper.getThreadPool().awaitQuiescence(60, TimeUnit.SECONDS);
+            }            
         } catch (Throwable t) {
             t.printStackTrace();
         }