jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1225587 - in /jmeter/trunk: src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java xdocs/changes.xml
Date Thu, 29 Dec 2011 16:45:12 GMT
Author: pmouawad
Date: Thu Dec 29 16:45:11 2011
New Revision: 1225587

URL: http://svn.apache.org/viewvc?rev=1225587&view=rev
Log:
Bug 52396 - TCP Sampler in "reuse connection mode" reuses previous sampler's connection even
if it's configured with other host, port, user or password 

Modified:
    jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java?rev=1225587&r1=1225586&r2=1225587&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java (original)
+++ jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java Thu
Dec 29 16:45:11 2011
@@ -144,7 +144,7 @@ public class TCPSampler extends Abstract
         Map<String, Object> cp = tp.get();
         Socket con = null;
         if (isReUseConnection()) {
-            con = (Socket) cp.get(TCPKEY);
+            con = (Socket) cp.get(getSocketKey());
             if (con != null) {
                 log.debug(this + " Reusing connection " + con); //$NON-NLS-1$
             }
@@ -159,7 +159,7 @@ public class TCPSampler extends Abstract
                 if(log.isDebugEnabled()) {
                     log.debug("Created new connection " + con); //$NON-NLS-1$
                 }
-                cp.put(TCPKEY, con);
+                cp.put(getSocketKey(), con);
             } catch (UnknownHostException e) {
                 log.warn("Unknown host for " + getLabel(), e);//$NON-NLS-1$
                 cp.put(ERRKEY, e.toString());
@@ -184,7 +184,14 @@ public class TCPSampler extends Abstract
         return con;
     }
 
-    public String getUsername() {
+    /**
+     * @return String socket key in cache Map
+     */
+    private final String getSocketKey() {
+		return TCPKEY+"#"+getServer()+"#"+getPort()+"#"+getUsername()+"#"+getPassword();
+	}
+
+	public String getUsername() {
         return getPropertyAsString(ConfigTestElement.USERNAME);
     }
 
@@ -437,7 +444,7 @@ public class TCPSampler extends Abstract
 
     private void closeSocket() {
         Map<String, Object> cp = tp.get();
-        Socket con = (Socket) cp.remove(TCPKEY);
+        Socket con = (Socket) cp.remove(getSocketKey());
         if (con != null) {
             log.debug(this + " Closing connection " + con); //$NON-NLS-1$
             try {

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1225587&r1=1225586&r2=1225587&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Thu Dec 29 16:45:11 2011
@@ -180,6 +180,7 @@ This behaviour can be changed with prope
 <li>Bug 52087 - TCPClient interface does not allow for partial reads</li>
 <li>Bug 52115 - SOAP/XML-RPC should not send a POST request when file to send is not
found</li>
 <li>Bug 40750 - TCPSampler : Behaviour when sockets are closed by remote host</li>
+<li>Bug 52396 - TCP Sampler in "reuse connection mode" reuses previous sampler's connection
even if it's configured with other host, port, user or password</li>
 </ul>
 
 <h3>Controllers</h3>



Mime
View raw message