You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by ms...@apache.org on 2003/01/22 23:51:37 UTC
cvs commit: jakarta-jmeter/src/core/org/apache/jmeter/threads JMeterThread.java ListenerNotifier.java TestCompiler.java
mstover1 2003/01/22 14:51:37
Modified: src/core/org/apache/jmeter/threads JMeterThread.java
ListenerNotifier.java TestCompiler.java
Log:
Attempting a fix for guy with 4 proc remote jmeter machine running out of memory
Revision Changes Path
1.13 +3 -2 jakarta-jmeter/src/core/org/apache/jmeter/threads/JMeterThread.java
Index: JMeterThread.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/threads/JMeterThread.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- JMeterThread.java 13 Dec 2002 21:37:28 -0000 1.12
+++ JMeterThread.java 22 Jan 2003 22:51:36 -0000 1.13
@@ -223,6 +223,7 @@
new SampleEvent(result, (String) controller.getProperty(TestElement.NAME));
compiler.sampleOccurred(event);
notifier.addLast(event,listeners);
+
}
public void setInitialDelay(int delay) {
initialDelay = delay;
1.9 +23 -9 jakarta-jmeter/src/core/org/apache/jmeter/threads/ListenerNotifier.java
Index: ListenerNotifier.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/threads/ListenerNotifier.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ListenerNotifier.java 17 Oct 2002 19:47:17 -0000 1.8
+++ ListenerNotifier.java 22 Jan 2003 22:51:36 -0000 1.9
@@ -23,6 +23,8 @@
*/
boolean running;
boolean isStopped;
+ static private int ABS_MAX = 500;
+ static private int MAX = 200;
int sleepTime = 2000;
public ListenerNotifier()
{
@@ -39,11 +41,7 @@
if (res != null)
{
List listeners = (List) this.removeFirst();
- iter = listeners.iterator();
- while (iter.hasNext())
- {
- ((SampleListener) iter.next()).sampleOccurred(res);
- }
+ notifyListeners(res, listeners);
}
try
{
@@ -52,7 +50,7 @@
catch (InterruptedException e)
{
}
- if (size() > 200 && Thread.currentThread().getPriority() == Thread.NORM_PRIORITY)
+ if (size() > MAX && Thread.currentThread().getPriority() == Thread.NORM_PRIORITY)
{
log.debug("Notifier thread priority going from normal to max, size = "+size());
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
@@ -61,15 +59,31 @@
log.debug("Listener Notifier stopped");
isStopped = true;
}
+ private void notifyListeners(SampleEvent res, List listeners)
+ {
+ Iterator iter;
+ iter = listeners.iterator();
+ while (iter.hasNext())
+ {
+ ((SampleListener) iter.next()).sampleOccurred(res);
+ }
+ }
public boolean isStopped()
{
return isStopped;
}
public synchronized void addLast(SampleEvent item, List listeners)
{
- super.addLast(item);
- super.addLast(listeners);
- sleepTime = 0;
+ if(size() > ABS_MAX)
+ {
+ notifyListeners(item,listeners);
+ }
+ else
+ {
+ super.addLast(item);
+ super.addLast(listeners);
+ sleepTime = 0;
+ }
}
public synchronized Object removeFirst()
{
1.12 +9 -10 jakarta-jmeter/src/core/org/apache/jmeter/threads/TestCompiler.java
Index: TestCompiler.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/threads/TestCompiler.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TestCompiler.java 29 Dec 2002 14:20:57 -0000 1.11
+++ TestCompiler.java 22 Jan 2003 22:51:36 -0000 1.12
@@ -9,7 +9,6 @@
import java.util.Set;
import org.apache.jmeter.assertions.Assertion;
-import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.config.Modifier;
import org.apache.jmeter.config.ResponseBasedModifier;
@@ -24,11 +23,11 @@
import org.apache.jmeter.testelement.PerSampleClonable;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.timers.Timer;
-import org.apache.log.Hierarchy;
-import org.apache.log.Logger;
import org.apache.jorphan.collections.HashTree;
import org.apache.jorphan.collections.HashTreeTraverser;
import org.apache.jorphan.collections.ListedHashTree;
+import org.apache.log.Hierarchy;
+import org.apache.log.Logger;
/****************************************
* <p>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>