Author: pmouawad
Date: Sat Dec 10 12:11:01 2011
New Revision: 1212780

URL: http://svn.apache.org/viewvc?rev=1212780&view=rev
Log:
Bug 52310 - variable in IPSource failed HTTP request if "Concurrent Pool Size" 
is enabled
Fix by making child get context of the parent.

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContextService.java
    
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContextService.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContextService.java?rev=1212780&r1=1212779&r2=1212780&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContextService.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContextService.java 
Sat Dec 10 12:11:01 2011
@@ -66,6 +66,14 @@ public final class JMeterContextService 
     }
 
     /**
+     * Replace Thread Context by the parameter
+     * @param context {@link JMeterContext}
+     */
+    public static void replaceContext(JMeterContext context) {
+       threadContext.remove();
+       threadContext.set(context);
+    }
+    /**
      * Method is called by the JMeterEngine class when a test run is started.
      * Zeroes numberOfActiveThreads.
      * Saves current time in a field and in the JMeter property "TESTSTART.MS"

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1212780&r1=1212779&r2=1212780&view=diff
==============================================================================
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
 Sat Dec 10 12:11:01 2011
@@ -70,6 +70,8 @@ import org.apache.jmeter.testelement.pro
 import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.testelement.property.StringProperty;
 import org.apache.jmeter.testelement.property.TestElementProperty;
+import org.apache.jmeter.threads.JMeterContext;
+import org.apache.jmeter.threads.JMeterContextService;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jmeter.util.JsseSSLManager;
 import org.apache.jmeter.util.SSLManager;
@@ -1727,6 +1729,7 @@ public abstract class HTTPSamplerBase ex
         final private boolean areFollowingRedirect;
         final private int depth;
         private final HTTPSamplerBase sampler;
+               private JMeterContext jmeterContextOfParentThread;
 
         ASyncSample(URL url, String method,
                 boolean areFollowingRedirect, int depth,  CookieManager 
cookieManager, HTTPSamplerBase base){
@@ -1745,9 +1748,11 @@ public abstract class HTTPSamplerBase ex
                 CookieManager clonedCookieManager = (CookieManager) 
cookieManager.clone();
                 this.sampler.setCookieManager(clonedCookieManager);
             } 
+            this.jmeterContextOfParentThread = 
JMeterContextService.getContext();
         }
 
         public AsynSamplerResultHolder call() {
+               
JMeterContextService.replaceContext(jmeterContextOfParentThread);
             ((CleanerThread) 
Thread.currentThread()).registerSamplerForEndNotification(sampler);
             HTTPSampleResult httpSampleResult = sampler.sample(url, method, 
areFollowingRedirect, depth);
             if(sampler.getCookieManager() != null) {


Reply via email to