activemq-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=411701&view=rev
Log:
Add synchronization block.

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=411701&r1=411700&r2=411701&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:36:48 2006
@@ -129,7 +129,10 @@
         // Compute for the actual duration window of the sampler
         long endTime = System.currentTimeMillis() + duration - rampDownTime;
         try {
-            Thread.sleep(rampUpTime);
+            try {
+                Thread.sleep(rampUpTime);
+            } catch (InterruptedException e) {
+            }
 
             // Let's reset the throughput first and start getting the samples
             for (Iterator i=perfClients.iterator(); i.hasNext();) {
@@ -138,14 +141,18 @@
             }
 
             while (System.currentTimeMillis() < endTime && !stop.get()) {
-                Thread.sleep(interval);
+                try {
+                    Thread.sleep(interval);
+                } catch (InterruptedException e) {
+                }
                 sampleClients();
                 sampleIndex++;
             }
-        } catch (InterruptedException e) {
         } finally {
             isRunning.set(false);
-            isRunning.notifyAll();
+            synchronized (isRunning) {
+                isRunning.notifyAll();
+            }
         }
     }
 
@@ -161,7 +168,9 @@
     public void waitForSamplerToFinish(long timeout) {
         while (isRunning.get()) {
             try {
-                isRunning.wait(timeout);
+                synchronized (isRunning) {
+                    isRunning.wait(timeout);
+                }
             } catch (InterruptedException e) {
             }
         }



Mime
View raw message