You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2019/08/24 20:03:56 UTC
[jmeter] 02/03: Remove Threadlocal perThreadInt on thread exit
This is an automated email from the ASF dual-hosted git repository.
fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git
commit 12206c5442083b34ace41b324f4b2ee7c6888504
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Sat Aug 24 21:59:35 2019 +0200
Remove Threadlocal perThreadInt on thread exit
---
.../java/org/apache/jmeter/functions/IterationCounter.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/functions/src/main/java/org/apache/jmeter/functions/IterationCounter.java b/src/functions/src/main/java/org/apache/jmeter/functions/IterationCounter.java
index 88e396a..9134eec 100644
--- a/src/functions/src/main/java/org/apache/jmeter/functions/IterationCounter.java
+++ b/src/functions/src/main/java/org/apache/jmeter/functions/IterationCounter.java
@@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.jmeter.engine.util.CompoundVariable;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
+import org.apache.jmeter.testelement.ThreadListener;
import org.apache.jmeter.threads.JMeterVariables;
import org.apache.jmeter.util.JMeterUtils;
@@ -34,7 +35,7 @@ import org.apache.jmeter.util.JMeterUtils;
* or globally.
* @since 1.X
*/
-public class IterationCounter extends AbstractFunction {
+public class IterationCounter extends AbstractFunction implements ThreadListener {
private static final List<String> desc = new LinkedList<>();
@@ -98,4 +99,14 @@ public class IterationCounter extends AbstractFunction {
public List<String> getArgumentDesc() {
return desc;
}
+
+ @Override
+ public void threadStarted() {
+ // Nothing to do on thread start
+ }
+
+ @Override
+ public void threadFinished() {
+ perThreadInt.remove();
+ }
}