mirror of https://github.com/apache/activemq.git
Add synchronization block.
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@411701 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
490407ed18
commit
33d7070056
|
@ -129,7 +129,10 @@ public class PerfMeasurementTool implements PerfEventListener, Runnable {
|
|||
// 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 @@ public class PerfMeasurementTool implements PerfEventListener, Runnable {
|
|||
}
|
||||
|
||||
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 class PerfMeasurementTool implements PerfEventListener, Runnable {
|
|||
public void waitForSamplerToFinish(long timeout) {
|
||||
while (isRunning.get()) {
|
||||
try {
|
||||
isRunning.wait(timeout);
|
||||
synchronized (isRunning) {
|
||||
isRunning.wait(timeout);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue