jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: svn commit: r1377291 - in /jmeter/trunk: src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java xdocs/changes.xml xdocs/usermanual/component_reference.xml
Date Sun, 26 Aug 2012 19:44:45 GMT
Thanks Milamber.
Fixed.

Regards
Philippe

On Sun, Aug 26, 2012 at 6:17 PM, Milamber <milamber@apache.org> wrote:

>
>
> Le 25/08/2012 14:17, pmouawad@apache.org a ecrit :
>
>  Author: pmouawad
>> Date: Sat Aug 25 13:17:19 2012
>> New Revision: 1377291
>>
>> URL: http://svn.apache.org/viewvc?**rev=1377291&view=rev<http://svn.apache.org/viewvc?rev=1377291&view=rev>
>> Log:
>> Bug 53782 - Enhance JavaSampler handling of JavaSamplerClient cleanup to
>> use less memory
>> Only register instance of JavaSamplerClient that have overriden or
>> implemented teardownTest
>> Bugzilla Id: 53782
>>
>> Modified:
>>      jmeter/trunk/src/protocol/**java/org/apache/jmeter/**
>> protocol/java/sampler/**JavaSampler.java
>>
>
> Seems introduce regression in junit tests.
>
>
>   [client] ... end of run
>      [echo] BatchTestLocal output files compared OK
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**4430d82d java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**30384065 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**4cf7c31d java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**1e2acc65 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**2c79809 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**3794d372 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**bc5fde0 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**56c163f java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**2bb5340c java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**212bcd4b java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**60de1b8a java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**15e232b5 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**7dc05ffd java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**7f92c8d9 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**72e6f7d2 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**303bc257 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**2ec791b9 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**538f1d7e java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**2353f67e java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**40589e56 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**5fe0f2f6 java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>    [concat] 2012/08/26 16:15:48 WARN  - jmeter.engine.**StandardJMeterEngine:
> Error encountered during shutdown of org.apache.jmeter.protocol.**
> java.sampler.JavaSampler@**5d3ad33d java.lang.NullPointerException
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**303)
>    [concat]     at org.apache.jmeter.protocol.**java.sampler.JavaSampler.*
> *testEnded(JavaSampler.java:**308)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.**
> notifyTestListenersOfEnd(**StandardJMeterEngine.java:220)
>    [concat]     at org.apache.jmeter.engine.**StandardJMeterEngine.run(**
> StandardJMeterEngine.java:423)
>    [concat]     at java.lang.Thread.run(Thread.**java:595)
>
> BUILD FAILED
>
>
>
>
>
>       jmeter/trunk/xdocs/changes.xml
>>      jmeter/trunk/xdocs/usermanual/**component_reference.xml
>>
>> Modified: jmeter/trunk/src/protocol/**java/org/apache/jmeter/**
>> protocol/java/sampler/**JavaSampler.java
>> URL: http://svn.apache.org/viewvc/**jmeter/trunk/src/protocol/**
>> java/org/apache/jmeter/**protocol/java/sampler/**
>> JavaSampler.java?rev=1377291&**r1=1377290&r2=1377291&view=**diff<http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java?rev=1377291&r1=1377290&r2=1377291&view=diff>
>> ==============================**==============================**
>> ==================
>> --- jmeter/trunk/src/protocol/**java/org/apache/jmeter/**
>> protocol/java/sampler/**JavaSampler.java (original)
>> +++ jmeter/trunk/src/protocol/**java/org/apache/jmeter/**
>> protocol/java/sampler/**JavaSampler.java Sat Aug 25 13:17:19 2012
>> @@ -18,10 +18,14 @@
>>
>>   package org.apache.jmeter.protocol.**java.sampler;
>>
>> +import java.lang.reflect.Method;
>>   import java.util.Arrays;
>>   import java.util.HashSet;
>> +import java.util.Map;
>>   import java.util.Set;
>> +import java.util.concurrent.**ConcurrentHashMap;
>>
>> +import org.apache.commons.lang3.**exception.ExceptionUtils;
>>   import org.apache.jmeter.config.**Arguments;
>>   import org.apache.jmeter.config.**ConfigTestElement;
>>   import org.apache.jmeter.samplers.**AbstractSampler;
>> @@ -74,6 +78,13 @@ public class JavaSampler extends Abstrac
>>       private transient JavaSamplerContext context = null;
>>
>>       /**
>> +     * Cache of classname, boolean that holds information about a class
>> and wether or not it should
>> +     * be registered for cleanup.
>> +     * This is done to avoid using reflection on each registration
>> +     */
>> +    private transient Map<String, Boolean>  isToBeRegisteredCache = new
>> ConcurrentHashMap<String, Boolean>();
>> +
>> +    /**
>>        * Set used to register all JavaSamplerClient and
>> JavaSamplerContext.
>>        * This is used so that the JavaSamplerClient can be notified when
>> the test ends.
>>        */
>> @@ -137,27 +148,72 @@ public class JavaSampler extends Abstrac
>>        * @param entry
>>        *            the Entry for this sample
>>        * @return test SampleResult
>> +     * @throws NoSuchMethodException
>> +     * @throws SecurityException
>>        */
>> -    public SampleResult sample(Entry entry) {
>> -        Arguments args = getArguments();
>> -        args.addArgument(TestElement.**NAME, getName()); // Allow
>> Sampler access
>> -                                                        // to test
>> element name
>> -        context = new JavaSamplerContext(args);
>> -        if (javaClient == null) {
>> -            log.debug(whoAmI() + "\tCreating Java Client");
>> -            createJavaClient();
>> -            javaClientAndContextSet.add(**new Object[]{javaClient,
>> context});
>> -            javaClient.setupTest(context);
>> +    public SampleResult sample(Entry entry) {
>> +        try {
>> +            Arguments args = getArguments();
>> +            args.addArgument(TestElement.**NAME, getName()); // Allow
>> Sampler access
>> +                                                            // to test
>> element name
>> +            context = new JavaSamplerContext(args);
>> +            if (javaClient == null) {
>> +                log.debug(whoAmI() + "\tCreating Java Client");
>> +                createJavaClient();
>> +                registerForCleanup(javaClient, context);
>> +                javaClient.setupTest(context);
>> +            }
>> +
>> +            SampleResult result = javaClient.runTest(context);
>> +
>> +            // Only set the default label if it has not been set
>> +            if (result != null&&  result.getSampleLabel().**length() ==
>> 0) {
>>
>> +                result.setSampleLabel(getName(**));
>> +            }
>> +
>> +            return result;
>> +        } catch(Exception ex) {
>> +            SampleResult sampleResultIfError = new SampleResult();
>> +            sampleResultIfError.**setSampleLabel(getName());
>> +            sampleResultIfError.**setSuccessful(false);
>> +            sampleResultIfError.**setResponseCode("500"); // $NON-NLS-1$
>> +            sampleResultIfError.**setResponseMessage(**ExceptionUtils.**
>> getRootCauseMessage(ex));
>> +            sampleResultIfError.**setResponseData(**
>> ExceptionUtils.getStackTrace(**ex), "UTF-8");
>> +            return sampleResultIfError;
>>           }
>> +    }
>>
>> -        SampleResult result = javaClient.runTest(context);
>> -
>> -        // Only set the default label if it has not been set
>> -        if (result != null&&  result.getSampleLabel().**length() == 0) {
>>
>> -            result.setSampleLabel(getName(**));
>> +    /**
>> +     * Only register jsClient if it contains a custom teardownTest method
>> +     * @param jsClient JavaSamplerClient
>> +     * @param jsContext JavaSamplerContext
>> +     * @throws NoSuchMethodException
>> +     * @throws SecurityException
>> +     */
>> +    private final void registerForCleanup(**JavaSamplerClient jsClient,
>> +            JavaSamplerContext jsContext) throws SecurityException,
>> NoSuchMethodException {
>> +        if(isToBeRegistered(jsClient.**getClass())) {
>> +            javaClientAndContextSet.add(**new Object[]{jsClient,
>> jsContext});
>>           }
>> +    }
>>
>> -        return result;
>> +    /**
>> +     * Tests clazz to see if a custom teardown method has been written
>> and caches the test result.
>> +     * If classes uses {@link AbstractJavaSamplerClient#**teardownTest(*
>> *JavaSamplerContext)} then it won't
>> +     * be registered for cleanup as it does nothing.
>> +     * @param clazz Class to be verified
>> +     * @return true if clazz should be registered for cleanup
>> +     * @throws SecurityException
>> +     * @throws NoSuchMethodException
>> +     */
>> +    private boolean isToBeRegistered(Class<? extends JavaSamplerClient>
>>  clazz) throws SecurityException, NoSuchMethodException {
>> +        Boolean isToBeRegistered = isToBeRegisteredCache.get(**
>> clazz.getName());
>> +        if(isToBeRegistered == null) {
>> +            Method method = clazz.getMethod("teardownTest"**, new
>> Class[]{JavaSamplerContext.**class});
>> +            isToBeRegistered = Boolean.valueOf(!method.**
>> getDeclaringClass().equals(**AbstractJavaSamplerClient.**class));
>> +            isToBeRegisteredCache.put(**clazz.getName(),
>> isToBeRegistered);
>> +        }
>> +        return isToBeRegistered.booleanValue(**);
>>       }
>>
>>       /**
>> @@ -244,6 +300,7 @@ public class JavaSampler extends Abstrac
>>               }
>>               javaClientAndContextSet.clear(**);
>>           }
>> +        isToBeRegisteredCache.clear();
>>       }
>>
>>       /* Implements TestStateListener.testEnded(**String) */
>>
>> Modified: jmeter/trunk/xdocs/changes.xml
>> URL: http://svn.apache.org/viewvc/**jmeter/trunk/xdocs/changes.**
>> xml?rev=1377291&r1=1377290&r2=**1377291&view=diff<http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1377291&r1=1377290&r2=1377291&view=diff>
>> ==============================**==============================**
>> ==================
>> --- jmeter/trunk/xdocs/changes.xml (original)
>> +++ jmeter/trunk/xdocs/changes.xml Sat Aug 25 13:17:19 2012
>> @@ -135,6 +135,7 @@ Shortcut for Function Helper Dialog is n
>>   <ul>
>>   <li><bugzilla>55310</bugzilla>  - TestAction should implement
>> Interruptible</li>
>>   <li><bugzilla>53318</bugzilla>  - Add Embedded URL Filter to
HTTP
>> Request Defaults Control</li>
>> +<li><bugzilla>53782</**bugzilla>  - Enhance JavaSampler handling
of
>> JavaSamplerClient cleanup to use less memory</li>
>>   </ul>
>>
>>   <h3>Controllers</h3>
>>
>> Modified: jmeter/trunk/xdocs/usermanual/**component_reference.xml
>> URL: http://svn.apache.org/viewvc/**jmeter/trunk/xdocs/usermanual/**
>> component_reference.xml?rev=**1377291&r1=1377290&r2=1377291&**view=diff<http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1377291&r1=1377290&r2=1377291&view=diff>
>> ==============================**==============================**
>> ==================
>> --- jmeter/trunk/xdocs/usermanual/**component_reference.xml (original)
>> +++ jmeter/trunk/xdocs/usermanual/**component_reference.xml Sat Aug 25
>> 13:17:19 2012
>> @@ -566,6 +566,9 @@ The fields allow variables to be used, s
>>   </p>
>>   </description>
>>
>> +<note>Since JMeter 2.8, if method teardownTest is not overriden by
>> subclasses of AbstractJavaSamplerClient, then the method will not be called
>> to optimise JMeter memory behaviour.
>> +This will not have any impact on existing Test plans.
>> +</note>
>>   <note>The Add/Delete buttons don't serve any purpose at present.</note>
>>
>>   <properties>
>>
>>
>>
>>
>


-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message