activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r411695 - /incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java
Date Mon, 05 Jun 2006 07:25:17 GMT
Author: aco
Date: Mon Jun  5 00:25:15 2006
New Revision: 411695

URL: http://svn.apache.org/viewvc?rev=411695&view=rev
Log:
- Add method to wait for performance sampler to finish

Modified:
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java?rev=411695&r1=411694&r2=411695&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java
Mon Jun  5 00:25:15 2006
@@ -35,6 +35,7 @@
 
     private AtomicBoolean start = new AtomicBoolean(false);
     private AtomicBoolean stop  = new AtomicBoolean(false);
+    private AtomicBoolean isRunning = new AtomicBoolean(false);
     private Properties samplerSettings = new Properties();
 
     private List perfClients = new ArrayList();
@@ -119,6 +120,8 @@
     public void startSampler() {
         Thread t = new Thread(this);
         t.setName("Performance Sampler");
+
+        isRunning.set(true);
         t.start();
     }
 
@@ -140,6 +143,8 @@
                 sampleIndex++;
             }
         } catch (InterruptedException e) {
+        } finally {
+            isRunning.set(false);
         }
     }
 
@@ -149,6 +154,15 @@
             System.out.println("<sample index=" + sampleIndex + " name=" + client.getClientName()
+
                                " throughput=" + client.getThroughput() + "/>");
             client.reset();
+        }
+    }
+
+    public void waitForSamplerToFinish(long timeout) {
+        while (isRunning.get()) {
+            try {
+                isRunning.wait(timeout);
+            } catch (InterruptedException e) {
+            }
         }
     }
 }



Mime
View raw message