Implement work-round to reduce classloading in non-GUI mode when scanning for Function classes.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/trunk@601090 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2007-12-04 21:26:35 +00:00
parent 398c1c5629
commit c69457e863
3 changed files with 47 additions and 8 deletions

View File

@ -587,6 +587,17 @@ beanshell.server.file=../extras/startup.bsh
# the following line.
#jmeterengine.startlistenerslater=false
#Should JMeter expand the tree when loading a test plan?
#onload.expandtree=false
# List of additional content types to be treated as text; separate entries with commas.
# If the content type begins with the same string, then it is treated as text.
# The following example types are already allowed for:
#content-type_text=text/,application/javascript,application/json,application/xhtml+xml
#---------------------------------------------------------------------------
# Classpath configuration
#---------------------------------------------------------------------------
# List of paths (separated by ;) to search for additional JMeter extension jars
# These are in addition to lib/ext. Do not use this for utility jars.
@ -597,13 +608,23 @@ beanshell.server.file=../extras/startup.bsh
# Paths with spaces may cause problems for the JVM
#user.classpath=../classes;../jars/jar1.jar
#Should JMeter expand the tree when loading a test plan?
#onload.expandtree=false
# Classpath finder
# ================
# The classpath finder currently needs to load every single JMeter class to find
# the classes it needs.
# For non-GUI mode, it's only necessary to scan for Function classes, but all classes
# are still loaded.
# All current Function classes include ".function." in their name,
# and none include ".gui." in the name, so the number of unwanted classes loaded can be
# reduced by checking for these. However, if a valid function class name does not match
# these restrictions, it will not be loaded. If problems are encountered, then comment
# or change the following properties:
classfinder.functions.contain=.functions.
classfinder.functions.notContain=.gui.
# List of additional content types to be treated as text; separate entries with commas.
# If the content type begins with the same string, then it is treated as text.
# The following example types are already allowed for:
#content-type_text=text/,application/javascript,application/json,application/xhtml+xml
#---------------------------------------------------------------------------
# Additional property files to load
#---------------------------------------------------------------------------
# Should JMeter automatically load additional JMeter properties?
# File name to look for (comment to disable)

View File

@ -58,8 +58,18 @@ public class CompoundVariable implements Function {
static {
try {
final String contain = // Classnames must contain this string [.functions.]
JMeterUtils.getProperty("classfinder.functions.contain"); // $NON-NLS-1$
final String notContain = // Classnames must not contain this string [.gui.]
JMeterUtils.getProperty("classfinder.functions.notContain"); // $NON-NLS-1$
if (contain!=null){
log.info("Note: Function class names must contain the string: '"+contain+"'");
}
if (notContain!=null){
log.info("Note: Function class names must not contain the string: '"+notContain+"'");
}
List classes = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(),
new Class[] { Function.class }, true);
new Class[] { Function.class }, true, contain, notContain);
Iterator iter = classes.iterator();
while (iter.hasNext()) {
Function tempFunc = (Function) Class.forName((String) iter.next()).newInstance();

View File

@ -33,7 +33,13 @@
<h4>Incompatible changes</h4>
<ul>
<li></li>
<li>
To reduce the number of classes loaded in non-GUI mode,
Functions will only be found if their classname contains the string
'.functions.' and does not contain the string '.gui.'.
All existing JMeter functions conform to this restriction.
To revert to earlier behaviour, comment or change the properties classfinder.functions.* in jmeter.properties.
</li>
</ul>
<h4>Bug fixes</h4>
@ -53,6 +59,8 @@
<li>Bug 43984 - trim spaces from port field</li>
<li>Add optional comment to __log() function</li>
<li>Make Random function variable name optional</li>
<li>Reduce class loading in non-GUI mode by only looking for Functions in class names
that contain '.functions.' and don't contain '.gui.'</li>
</ul>
<h4>Non-functional changes</h4>