jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1422654 - /jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java
Date Sat, 05 Jan 2013 21:33:26 GMT
On 16 December 2012 18:21,  <pmouawad@apache.org> wrote:
> Author: pmouawad
> Date: Sun Dec 16 18:21:45 2012
> New Revision: 1422654
>
> URL: http://svn.apache.org/viewvc?rev=1422654&view=rev
> Log:
> Bug 54259 - Introduce a CSS or jquery-like based Extractor
> Introduce parse caching to improve performances
> Bugzilla Id: 54259
>
> Modified:
>     jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java?rev=1422654&r1=1422653&r2=1422654&view=diff
> ==============================================================================
> --- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java Sun Dec 16 18:21:45
2012
> @@ -18,6 +18,9 @@
>
>  package org.apache.jmeter.threads;
>
> +import java.util.Map;
> +import java.util.concurrent.ConcurrentHashMap;
> +
>  import org.apache.jmeter.engine.StandardJMeterEngine;
>  import org.apache.jmeter.samplers.SampleResult;
>  import org.apache.jmeter.samplers.Sampler;
> @@ -51,6 +54,8 @@ public class JMeterContext {
>
>      private boolean restartNextLoop = false;
>
> +    private ConcurrentHashMap<String, Object> samplerContext = new ConcurrentHashMap<String,
Object>(5);
> +

This creates a hashmap even if it is never used.

I'm not sure that is a good idea.

>      JMeterContext() {
>          clear0();
>      }
> @@ -68,6 +73,7 @@ public class JMeterContext {
>          threadNum = 0;
>          thread = null;
>          isReinitSubControllers = false;
> +        samplerContext.clear();
>      }
>
>      /**
> @@ -213,5 +219,14 @@ public class JMeterContext {
>          if(previousResult != null) {
>              previousResult.cleanAfterSample();
>          }
> +        samplerContext.clear();
> +    }
> +
> +    /**
> +     * Sampler context is cleaned up as soon as Post-Processor have ended
> +     * @return Context to use within PostProcessors to cache data
> +     */
> +    public Map<String, Object> getSamplerContext() {
> +        return samplerContext;
>      }
>  }
>
>

Mime
View raw message