Le 29/10/2012 00:54, sebb a ecrit :
On 26 October 2012 18:04,<[email protected]>  wrote:
Author: milamber
Date: Fri Oct 26 17:04:00 2012
New Revision: 1402574

URL: http://svn.apache.org/viewvc?rev=1402574&view=rev
Log:
When used the options Retrieve All Embedded Resources + Concurrent pool, these 
log.warn() generates a lot of lines in jmeter.log.

Modified:
     
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
-1, see below.

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=1402574&r1=1402573&r2=1402574&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
 Fri Oct 26 17:04:00 2012
@@ -753,7 +753,7 @@ public abstract class HTTPSamplerBase ex

      public void setAuthManager(AuthManager value) {
          AuthManager mgr = getAuthManager();
-        if (mgr != null) {
+        if (log.isDebugEnabled()&&  mgr != null) {
              log.warn("Existing AuthManager " + mgr.getName() + " superseded by 
" + value.getName());
I'm not very happy with this fix, as it suppresses the warnings when
Concurrent pool is not in use.
It also presumably does not display valid warnings if concurrent pool is in use.

I've not looked at the code yet, but there has to be a better way to do this.
Ideally change the pool code so it does not generate the overrides.

In attachment a patch to fix the first incorrect fix.
* revert on setAuthManager(), it's not necessary
* add 2 new methods with a boolean parameter if call from the concurrent pool.

It's a good way? or another better way exists?




Also, the code looks odd - why check for debug yet report a warning?

          }
          setProperty(new TestElementProperty(AUTH_MANAGER, value));
@@ -783,7 +783,7 @@ public abstract class HTTPSamplerBase ex

      public void setCookieManager(CookieManager value) {
          CookieManager mgr = getCookieManager();
-        if (mgr != null) {
+        if (log.isDebugEnabled()&&  mgr != null) {
              log.warn("Existing CookieManager " + mgr.getName() + " superseded by 
" + value.getName());
          }
          setProperty(new TestElementProperty(COOKIE_MANAGER, value));
@@ -795,7 +795,7 @@ public abstract class HTTPSamplerBase ex

      public void setCacheManager(CacheManager value) {
          CacheManager mgr = getCacheManager();
-        if (mgr != null) {
+        if (log.isDebugEnabled()&&  mgr != null) {
              log.warn("Existing CacheManager " + mgr.getName() + " superseded by 
" + value.getName());
          }
          setProperty(new TestElementProperty(CACHE_MANAGER, value));



Index: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
===================================================================
--- src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java	(revision 1403187)
+++ src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java	(working copy)
@@ -753,8 +753,8 @@
 
     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,26 +781,42 @@
         return (HeaderManager) getProperty(HEADER_MANAGER).getObjectValue();
     }
 
-    public void setCookieManager(CookieManager value) {
+    /**
+     * @param value
+     * @param async - true if call from concurrent pool
+     */
+    public void setCookieManager(CookieManager value, boolean async) {
         CookieManager mgr = getCookieManager();
-        if (log.isDebugEnabled() && mgr != null) {
+        if (!async && mgr != null) {
             log.warn("Existing CookieManager " + mgr.getName() + " superseded by " + value.getName());
         }
         setProperty(new TestElementProperty(COOKIE_MANAGER, value));
     }
 
+    public void setCookieManager(CookieManager value) {
+        setCookieManager(value, false);
+    }
+
     public CookieManager getCookieManager() {
         return (CookieManager) getProperty(COOKIE_MANAGER).getObjectValue();
     }
 
-    public void setCacheManager(CacheManager value) {
+    /**
+     * @param value
+     * @param async - true if call from concurrent pool
+     */
+    public void setCacheManager(CacheManager value, boolean async) {
         CacheManager mgr = getCacheManager();
-        if (log.isDebugEnabled() && mgr != null) {
+        if (!async && mgr != null) {
             log.warn("Existing CacheManager " + mgr.getName() + " superseded by " + value.getName());
         }
         setProperty(new TestElementProperty(CACHE_MANAGER, value));
     }
 
+    public void setCacheManager(CacheManager value) {
+        setCacheManager(value, false);
+    }
+
     public CacheManager getCacheManager() {
         return (CacheManager) getProperty(CACHE_MANAGER).getObjectValue();
     }
@@ -1765,12 +1781,12 @@
             // 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.setCacheManager(cacheManager, true);
             }
             
             if(cookieManager != null) {
                 CookieManager clonedCookieManager = (CookieManager) cookieManager.clone();
-                this.sampler.setCookieManager(clonedCookieManager);
+                this.sampler.setCookieManager(clonedCookieManager, true);
             } 
             this.jmeterContextOfParentThread = JMeterContextService.getContext();
         }

Reply via email to