You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2012/11/01 15:44:20 UTC

svn commit: r1404616 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java

Author: sebb
Date: Thu Nov  1 14:44:19 2012
New Revision: 1404616

URL: http://svn.apache.org/viewvc?rev=1404616&view=rev
Log:
Rework & simplify r1402642 and r1402574
Avoid incorrect warning logs when using concurrent pool with cookie manager or cache manager

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

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=1404616&r1=1404615&r2=1404616&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 Thu Nov  1 14:44:19 2012
@@ -753,8 +753,8 @@ public abstract class HTTPSamplerBase ex
 
     public void setAuthManager(AuthManager value) {
         AuthManager mgr = getAuthManager();
-        if (log.isDebugEnabled() && mgr != null) {
-            log.debug("Existing AuthManager " + mgr.getName() + " superseded by " + value.getName());
+        if (mgr != null) {
+            log.warn("Existing AuthManager " + mgr.getName() + " superseded by " + value.getName());
         }
         setProperty(new TestElementProperty(AUTH_MANAGER, value));
     }
@@ -781,24 +781,34 @@ public abstract class HTTPSamplerBase ex
         return (HeaderManager) getProperty(HEADER_MANAGER).getObjectValue();
     }
 
+    // private method to allow AsyncSample to reset the value without performing checks
+    private void setCookieManagerProperty(CookieManager value) {
+        setProperty(new TestElementProperty(COOKIE_MANAGER, value));        
+    }
+
     public void setCookieManager(CookieManager value) {
         CookieManager mgr = getCookieManager();
-        if (log.isDebugEnabled() && mgr != null) {
+        if (mgr != null) {
             log.warn("Existing CookieManager " + mgr.getName() + " superseded by " + value.getName());
         }
-        setProperty(new TestElementProperty(COOKIE_MANAGER, value));
+        setCookieManagerProperty(value);
     }
 
     public CookieManager getCookieManager() {
         return (CookieManager) getProperty(COOKIE_MANAGER).getObjectValue();
     }
 
+    // private method to allow AsyncSample to reset the value without performing checks
+    private void setCacheManagerProperty(CacheManager value) {
+        setProperty(new TestElementProperty(CACHE_MANAGER, value));
+    }
+
     public void setCacheManager(CacheManager value) {
         CacheManager mgr = getCacheManager();
-        if (log.isDebugEnabled() && mgr != null) {
+        if (mgr != null) {
             log.warn("Existing CacheManager " + mgr.getName() + " superseded by " + value.getName());
         }
-        setProperty(new TestElementProperty(CACHE_MANAGER, value));
+        setCacheManagerProperty(value);
     }
 
     public CacheManager getCacheManager() {
@@ -1765,12 +1775,12 @@ public abstract class HTTPSamplerBase ex
             // We don't want to use CacheManager clone but the parent one, and CacheManager is Thread Safe
             CacheManager cacheManager = base.getCacheManager();
             if (cacheManager != null) {
-                this.sampler.setCacheManager(cacheManager);
+                this.sampler.setCacheManagerProperty(cacheManager);
             }
             
             if(cookieManager != null) {
                 CookieManager clonedCookieManager = (CookieManager) cookieManager.clone();
-                this.sampler.setCookieManager(clonedCookieManager);
+                this.sampler.setCookieManagerProperty(clonedCookieManager);
             } 
             this.jmeterContextOfParentThread = JMeterContextService.getContext();
         }