jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] 01/02: Add more log messages about the delays
Date Sat, 07 Sep 2019 13:25:09 GMT
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 3f78a23e4f91e17dde1c3cac86f60b828de36b05
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Sat Sep 7 15:09:58 2019 +0200

    Add more log messages about the delays
    
    while on the bug 63711 it helped me to debug the error and I think it can be of
    value for others, too. While at it a typo was fixed (looop -> loop) and a bit of
    whitespace was added.
    
    Bugzilla Id: 63711
---
 .../java/org/apache/jmeter/sampler/TestAction.java | 23 ++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/components/src/main/java/org/apache/jmeter/sampler/TestAction.java b/src/components/src/main/java/org/apache/jmeter/sampler/TestAction.java
index c6d5d2b..210a2f9 100644
--- a/src/components/src/main/java/org/apache/jmeter/sampler/TestAction.java
+++ b/src/components/src/main/java/org/apache/jmeter/sampler/TestAction.java
@@ -69,7 +69,7 @@ public class TestAction extends AbstractSampler implements Interruptible
{
      */
     public static final int START_NEXT_ITERATION_CURRENT_LOOP = 4;
     /**
-     * Break Current Looop
+     * Break Current Loop
      */
     public static final int BREAK_CURRENT_LOOP = 5;
 
@@ -143,11 +143,11 @@ public class TestAction extends AbstractSampler implements Interruptible
{
     private void pause(String timeInMillis) {
         long millis;
         try {
-            if(!StringUtils.isEmpty(timeInMillis)) {
-                millis=Long.parseLong(timeInMillis);
+            if (!StringUtils.isEmpty(timeInMillis)) {
+                millis = Long.parseLong(timeInMillis);
             } else {
                 log.warn("Duration value is empty, defaulting to 0");
-                millis=0L;
+                millis = 0L;
             }
         } catch (NumberFormatException e){
             log.warn("Could not parse number: '{}'", timeInMillis);
@@ -155,12 +155,19 @@ public class TestAction extends AbstractSampler implements Interruptible
{
         }
         try {
             pauseThread = Thread.currentThread();
-            if(millis>0) {
-                TimeUnit.MILLISECONDS.sleep(TIMER_SERVICE.adjustDelay(millis));
-            } else if(millis<0) {
-                throw new IllegalArgumentException("Configured sleep is negative:"+millis);
+            if (millis > 0) {
+                long adjustDelay = TIMER_SERVICE.adjustDelay(millis);
+                if (log.isDebugEnabled()) {
+                    log.debug("Sleeping in Flow Control Action for {} ms (asked for {} ms)",
+                            Long.valueOf(adjustDelay),
+                            Long.valueOf(millis));
+                }
+                TimeUnit.MILLISECONDS.sleep(adjustDelay);
+            } else if (millis < 0) {
+                throw new IllegalArgumentException("Configured sleep is negative:" + millis);
             } // else == 0 we do nothing
         } catch (InterruptedException e) {
+            log.debug("Flow Control Action got interrupted");
             Thread.currentThread().interrupt();
         } finally {
             pauseThread = null;


Mime
View raw message