You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2012/08/13 18:06:12 UTC

svn commit: r1372484 - /jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java

Author: sebb
Date: Mon Aug 13 16:06:12 2012
New Revision: 1372484

URL: http://svn.apache.org/viewvc?rev=1372484&view=rev
Log:
delayedStartup needs to be constant
Bugzilla Id: 53418

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java?rev=1372484&r1=1372483&r2=1372484&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java Mon Aug 13 16:06:12 2012
@@ -83,6 +83,11 @@ public class ThreadGroup extends Abstrac
     private AtomicBoolean stopped = new AtomicBoolean(false);
 
     /**
+     * Are we using delayed startup?
+     */
+    private boolean delayedStartup;
+
+    /**
      * No-arg constructor.
      */
     public ThreadGroup() {
@@ -98,7 +103,7 @@ public class ThreadGroup extends Abstrac
         setProperty(new BooleanProperty(SCHEDULER, Scheduler));
     }
 
-    public boolean getOnDemand() {
+    private boolean isDelayedStartup() {
         return getPropertyAsBoolean(DELAYED_START);
     }
 
@@ -209,7 +214,8 @@ public class ThreadGroup extends Abstrac
    @Override
    public void scheduleThread(JMeterThread thread)
    {
-       if (getOnDemand()) {
+       if (isDelayedStartup()) { // Fetch once; needs to stay constant
+           delayedStartup = true; 
            // No delay as OnDemandThreadGroup starts thread during rampup
            thread.setInitialDelay(0);
        } else {
@@ -284,7 +290,7 @@ public class ThreadGroup extends Abstrac
      */
     @Override
     public void start() {
-        if (getOnDemand()) {
+        if (delayedStartup) {
             stopped.set(false);
             this.threadStarter = new Thread(new ThreadStarter(), getName()+"-ThreadStarter");
             threadStarter.start();  
@@ -368,7 +374,7 @@ public class ThreadGroup extends Abstrac
      */
     @Override
     public void tellThreadsToStop() {
-        if (getOnDemand()) {
+        if (delayedStartup) {
             stopped.set(true);
             try {
                 threadStarter.interrupt();
@@ -396,7 +402,7 @@ public class ThreadGroup extends Abstrac
      */
     @Override
     public void stop() {
-        if (getOnDemand()) {
+        if (delayedStartup) {
             stopped.set(true);
             try {
                 threadStarter.interrupt();
@@ -423,7 +429,7 @@ public class ThreadGroup extends Abstrac
     @Override
     public boolean verifyThreadsStopped() {
         boolean stoppedAll = true;
-        if (getOnDemand()){
+        if (delayedStartup){
             stoppedAll &= verifyThreadStopped(threadStarter);
         }
         for (Thread t : allThreads.values()) {
@@ -459,7 +465,7 @@ public class ThreadGroup extends Abstrac
      */
     @Override
     public void waitThreadsStopped() {
-        if (getOnDemand()) {
+        if (delayedStartup) {
             waitThreadStopped(threadStarter);            
         }
         for (Thread t : allThreads.values()) {