Author: sebb
Date: Fri Apr  4 19:01:51 2008
New Revision: 645012

URL: http://svn.apache.org/viewvc?rev=645012&view=rev
Log:
Bug 40850 - BeanShell memory leak
Update documentation for Beanshell reset etc

Modified:
    jakarta/jmeter/trunk/docs/images/screenshots/beanshell_listener.png
    jakarta/jmeter/trunk/docs/images/screenshots/beanshell_postprocessor.png
    jakarta/jmeter/trunk/docs/images/screenshots/beanshell_preprocessor.png
    jakarta/jmeter/trunk/docs/images/screenshots/beanshellsampler.png
    jakarta/jmeter/trunk/docs/images/screenshots/bsh_assertion.png
    jakarta/jmeter/trunk/docs/images/screenshots/timers/beanshell_timer.png
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/usermanual/best-practices.xml
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jakarta/jmeter/trunk/docs/images/screenshots/beanshell_listener.png
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/beanshell_listener.png?rev=645012&r1=645011&r2=645012&view=diff
==============================================================================
Binary files - no diff available.

Modified: 
jakarta/jmeter/trunk/docs/images/screenshots/beanshell_postprocessor.png
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/beanshell_postprocessor.png?rev=645012&r1=645011&r2=645012&view=diff
==============================================================================
Binary files - no diff available.

Modified: 
jakarta/jmeter/trunk/docs/images/screenshots/beanshell_preprocessor.png
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/beanshell_preprocessor.png?rev=645012&r1=645011&r2=645012&view=diff
==============================================================================
Binary files - no diff available.

Modified: jakarta/jmeter/trunk/docs/images/screenshots/beanshellsampler.png
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/beanshellsampler.png?rev=645012&r1=645011&r2=645012&view=diff
==============================================================================
Binary files - no diff available.

Modified: jakarta/jmeter/trunk/docs/images/screenshots/bsh_assertion.png
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/bsh_assertion.png?rev=645012&r1=645011&r2=645012&view=diff
==============================================================================
Binary files - no diff available.

Modified: 
jakarta/jmeter/trunk/docs/images/screenshots/timers/beanshell_timer.png
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/timers/beanshell_timer.png?rev=645012&r1=645011&r2=645012&view=diff
==============================================================================
Binary files - no diff available.

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=645012&r1=645011&r2=645012&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Fri Apr  4 19:01:51 2008
@@ -94,6 +94,7 @@
 <li>Regular Expression Extractor now deletes all stale variables from previous 
matches.</li>
 <li>Bug 44707 - Running remote test changes internal test plan</li>
 <li>Bug 44625 - Cannot have two or more FTP samplers with different "put" and 
"get" actions</li>
+<li>Bug 40850 - BeanShell memory leak</li>
 </ul>
 
 <h4>Improvements</h4>

Modified: jakarta/jmeter/trunk/xdocs/usermanual/best-practices.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/best-practices.xml?rev=645012&r1=645011&r2=645012&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/best-practices.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/best-practices.xml Fri Apr  4 
19:01:51 2008
@@ -198,6 +198,52 @@
 </pre>
 </section>
 
-
+<section name="&sect-num;.8 BeanShell scripting" anchor="bsh_scripting">
+<subsection name="&sect-num;.8.1 Overview" anchor="bsh_overview">
+<p>
+Each BeanShell test element has its own copy of the interpreter (for each 
thread).
+If the test element is repeatedly called, e.g. within a loop, then the 
interpreter is retained
+between invocations unless the "Reset bsh.Interpreter before each call" option 
is selected.
+</p>
+<p>
+Some long-running tests may cause the interpreter to use lots of memory; if 
this is the case try using the reset option.
+</p>
+</subsection>
+<subsection name="&sect-num;.8.2 Sharing Variables" anchor="bsh_variables">
+<p>
+Variables can be defined in startup (initialisation) scripts.
+These will be retained across invocations of the test element, unless the 
reset option is used.\
+</p>
+<p>
+Scripts can also access JMeter variables using the get() and put() methods of 
the "vars" variable,
+for example: <code>vars.get("HOST"); vars.put("MSG","Successful");</code>.
+The get() and put() methods only support variables with String values,
+but there are also getObject() and putObject() methods which can be used for 
arbitrary objects.
+JMeter variables are local to a thread, but can be used by all test elements 
(not just Beanshell).
+</p>
+<p>
+If you need to share variables between threads, then JMeter properties can be 
used:
+<pre>
+import org.apache.jmeter.util.JMeterUtils;
+String value=JMeterUtils.getPropDefault("name","");
+JMeterUtils.setProperty("name", "value");
+</pre>
+The sample .bshrc files contain sample definitions of getprop() and setprop() 
methods.
+</p>
+<p>
+Another possible method of sharing variables is to use the "bsh.shared" shared 
namespace.
+For example:
+<pre>
+if (bsh.shared.myObj == void){
+    // not yet defined, so create it:
+    myObj=new AnyObject();
+}
+bsh.shared.myObj.process();
+</pre>
+Rather than creating the object in the test element, it can be created in the 
startup file
+defined by the JMeter property "beanshell.init.file". This is only processed 
once.
+</p>
+</subsection>
+</section>
 </body>
 </document>

Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=645012&r1=645011&r2=645012&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Fri Apr  4 
19:01:51 2008
@@ -789,7 +789,7 @@
 </p>
 </component>
 
-<component name="BeanShell Sampler" index="&sect-num;.1.10"  width="601" 
height="244" screenshot="beanshellsampler.png">
+<component name="BeanShell Sampler" index="&sect-num;.1.10"  width="592" 
height="303" screenshot="beanshellsampler.png">
        <description><p>This sampler allows you to write a sampler using the 
BeanShell scripting language.              
 </p><p>
                <b>Please note that the BeanShell jar file is not included with 
JMeter; it needs to be separately downloaded.
@@ -804,7 +804,14 @@
        </description>
 <properties>
        <property name="Name" required="No">Descriptive name for this 
controller that is shown in the tree.</property>
+    <property name="Reset bsh.Interpreter before each call" required="Yes">
+    If this option is selected, then the interpreter will be recreated for 
each sample.
+    This may be necessary for some long running scripts. 
+    For further information, see <a href="best-practices#bsh_scripting">Best 
Practices - BeanShell scripting</a>.
+    </property>
     <property name="Parameters" required="No">Parameters to pass to the 
BeanShell script.
+    This is intended for use with script files; for scripts defined in the 
GUI, you can use whatever
+    variable and function references you need within the script itself.
        The parameters are stored in the following variables:
        <ul>
                <li>Parameters - string containing the parameters as a single 
variable</li>
@@ -2029,7 +2036,7 @@
 </properties>
 </component>
 
-<component name="BeanShell Listener"  index="&sect-num;.3.14"  width="516" 
height="286" screenshot="beanshell_listener.png">
+<component name="BeanShell Listener"  index="&sect-num;.3.14"  width="597" 
height="303" screenshot="beanshell_listener.png">
 <description>
 <p>
 The BeanShell Listener allows the use of BeanShell for processing samples for 
saving etc.
@@ -2047,6 +2054,11 @@
 </description>
 <properties>
     <property name="Name" required="">Descriptive name for this element that 
is shown in the tree.</property>
+    <property name="Reset bsh.Interpreter before each call" required="Yes">
+    If this option is selected, then the interpreter will be recreated for 
each sample.
+    This may be necessary for some long running scripts. 
+    For further information, see <a href="best-practices#bsh_scripting">Best 
Practices - BeanShell scripting</a>.
+    </property>
     <property name="Parameters" required="No">Parameters to pass to the 
BeanShell script.
        The parameters are stored in the following variables:
        <ul>
@@ -2642,7 +2654,7 @@
 </properties>
 </component>
 
-<component name="BeanShell Assertion" index="&sect-num;.5.5"  width="632" 
height="253" screenshot="bsh_assertion.png">
+<component name="BeanShell Assertion" index="&sect-num;.5.5"  width="597" 
height="303" screenshot="bsh_assertion.png">
 <description><p>The BeanShell Assertion allows the user to perform assertion 
checking using a BeanShell script.
 </p>
 <p>
@@ -2672,6 +2684,11 @@
 
 <properties>
     <property name="Name" required="">Descriptive name for this element that 
is shown in the tree.</property>
+    <property name="Reset bsh.Interpreter before each call" required="Yes">
+    If this option is selected, then the interpreter will be recreated for 
each sample.
+    This may be necessary for some long running scripts. 
+    For further information, see <a href="best-practices#bsh_scripting">Best 
Practices - BeanShell scripting</a>.
+    </property>
     <property name="Parameters" required="No">Parameters to pass to the 
BeanShell script.
        The parameters are stored in the following variables:
        <ul>
@@ -2908,6 +2925,11 @@
 </description>
 <properties>
     <property name="Name" required="No">Descriptive name for this element that 
is shown in the tree.</property>
+    <property name="Reset bsh.Interpreter before each call" required="Yes">
+    If this option is selected, then the interpreter will be recreated for 
each sample.
+    This may be necessary for some long running scripts. 
+    For further information, see <a href="best-practices#bsh_scripting">Best 
Practices - BeanShell scripting</a>.
+    </property>
     <property name="Parameters" required="No">Parameters to pass to the 
BeanShell script.
        The parameters are stored in the following variables:
        <ul>
@@ -3124,7 +3146,7 @@
 </properties>
 </component>
 
-<component name="BeanShell PreProcessor" index="&sect-num;.7.7"  width="516" 
height="286" screenshot="beanshell_preprocessor.png">
+<component name="BeanShell PreProcessor" index="&sect-num;.7.7"  width="597" 
height="303" screenshot="beanshell_preprocessor.png">
 <description>
 <p>
 The BeanShell PreProcessor allows arbitrary code to be applied before taking a 
sample.
@@ -3142,6 +3164,11 @@
 </description>
 <properties>
     <property name="Name" required="No">Descriptive name for this element that 
is shown in the tree.</property>
+    <property name="Reset bsh.Interpreter before each call" required="Yes">
+    If this option is selected, then the interpreter will be recreated for 
each sample.
+    This may be necessary for some long running scripts. 
+    For further information, see <a href="best-practices#bsh_scripting">Best 
Practices - BeanShell scripting</a>.
+    </property>
     <property name="Parameters" required="No">Parameters to pass to the 
BeanShell script.
        The parameters are stored in the following variables:
        <ul>
@@ -3364,7 +3391,7 @@
  </properties>
 </component>
 
-<component name="BeanShell PostProcessor"  index="&sect-num;.8.6"  width="516" 
height="286" screenshot="beanshell_postprocessor.png">
+<component name="BeanShell PostProcessor"  index="&sect-num;.8.6"  width="597" 
height="303" screenshot="beanshell_postprocessor.png">
 <description>
 <p>
 The BeanShell PreProcessor allows arbitrary code to be applied after taking a 
sample.
@@ -3383,6 +3410,11 @@
 </description>
 <properties>
     <property name="Name" required="No">Descriptive name for this element that 
is shown in the tree.</property>
+    <property name="Reset bsh.Interpreter before each call" required="Yes">
+    If this option is selected, then the interpreter will be recreated for 
each sample.
+    This may be necessary for some long running scripts. 
+    For further information, see <a href="best-practices#bsh_scripting">Best 
Practices - BeanShell scripting</a>.
+    </property>
     <property name="Parameters" required="No">Parameters to pass to the 
BeanShell script.
        The parameters are stored in the following variables:
        <ul>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to