Author: pmouawad
Date: Mon Jun 4 20:17:31 2012
New Revision: 1346144
URL: http://svn.apache.org/viewvc?rev=1346144&view=rev
Log:
Bug 53357 - JMS Point to Point reports too high response times in Request
Response Mode
Modified:
jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java
jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/MessageAdmin.java
jmeter/trunk/xdocs/changes.xml
Modified:
jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java?rev=1346144&r1=1346143&r2=1346144&view=diff
==============================================================================
---
jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java
(original)
+++
jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java
Mon Jun 4 20:17:31 2012
@@ -18,6 +18,8 @@
package org.apache.jmeter.protocol.jms.sampler;
+import java.util.concurrent.CountDownLatch;
+
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
@@ -69,29 +71,27 @@ public class FixedQueueExecutor implemen
if(id == null && !useReqMsgIdAsCorrelId){
throw new IllegalArgumentException("Correlation id is null. Set
the JMSCorrelationID header.");
}
-
+ final CountDownLatch countDownLatch = new CountDownLatch(1);
final MessageAdmin admin = MessageAdmin.getAdmin();
if(useReqMsgIdAsCorrelId) {// msgId not available until after send()
is called
// Note: there is only one admin object which is shared between
all threads
synchronized (admin) {// interlock with Receiver
producer.send(request);
id=request.getJMSMessageID();
- admin.putRequest(id, request);
+ admin.putRequest(id, request, countDownLatch);
}
} else {
- admin.putRequest(id, request);
+ admin.putRequest(id, request, countDownLatch);
producer.send(request);
}
try {
if (log.isDebugEnabled()) {
- log.debug("wait for reply " + id + " started on " +
System.currentTimeMillis());
- }
- synchronized (request) {
- request.wait(timeout);
+ log.debug(Thread.currentThread().getName()+" will wait for
reply " + id + " started on " + System.currentTimeMillis());
}
+ countDownLatch.await();
if (log.isDebugEnabled()) {
- log.debug("done waiting for " + id + " ended on " +
System.currentTimeMillis());
+ log.debug(Thread.currentThread().getName()+" done waiting for
" + id + " on "+request+" ended on " + System.currentTimeMillis());
}
} catch (InterruptedException e) {
Modified:
jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/MessageAdmin.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/MessageAdmin.java?rev=1346144&r1=1346143&r2=1346144&view=diff
==============================================================================
---
jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/MessageAdmin.java
(original)
+++
jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/MessageAdmin.java
Mon Jun 4 20:17:31 2012
@@ -20,6 +20,7 @@ package org.apache.jmeter.protocol.jms.s
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
import javax.jms.Message;
@@ -47,11 +48,11 @@ public class MessageAdmin {
/**
* @param request
*/
- public void putRequest(String id, Message request) {
+ public void putRequest(String id, Message request, CountDownLatch latch) {
if (log.isDebugEnabled()) {
log.debug("REQ_ID [" + id + "]");
}
- table.put(id, new PlaceHolder(request));
+ table.put(id, new PlaceHolder(request, latch));
}
public void putReply(String id, Message reply) {
@@ -61,10 +62,13 @@ public class MessageAdmin {
}
if (holder != null) {
holder.setReply(reply);
- Object obj = holder.getRequest();
- // Findbugs : False positive
- synchronized (obj) {
- obj.notify();
+ CountDownLatch latch = holder.getLatch();
+ if (log.isDebugEnabled()) {
+ log.debug(Thread.currentThread().getName()+" releasing latch :
" + latch);
+ }
+ latch.countDown();
+ if (log.isDebugEnabled()) {
+ log.debug(Thread.currentThread().getName()+" released latch :
" + latch);
}
} else {
if (log.isDebugEnabled()) {
@@ -93,12 +97,14 @@ public class MessageAdmin {
}
class PlaceHolder {
+ private final CountDownLatch latch;
private final Object request;
private Object reply;
- PlaceHolder(Object original) {
+ PlaceHolder(Object original, CountDownLatch latch) {
this.request = original;
+ this.latch = latch;
}
void setReply(Object reply) {
@@ -121,4 +127,11 @@ class PlaceHolder {
public String toString() {
return "request=" + request + ", reply=" + reply;
}
+
+ /**
+ * @return the latch
+ */
+ public CountDownLatch getLatch() {
+ return latch;
+ }
}
\ No newline at end of file
Modified: jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1346144&r1=1346143&r2=1346144&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Mon Jun 4 20:17:31 2012
@@ -64,6 +64,7 @@ or a Debug Sampler with all fields set t
<h3>Other Samplers</h3>
<ul>
<li><bugzilla>53348</bugzilla> - JMeter JMS Point-to-Point Request-Response
sampler doesn't work when Request-queue and Receive-queue are different</li>
+<li><bugzilla>53357</bugzilla> - JMS Point to Point reports too high response
times in Request Response Mode</li>
</ul>
<h3>Controllers</h3>