Author: sebb
Date: Thu Apr 23 03:02:19 2009
New Revision: 767770

URL: http://svn.apache.org/viewvc?rev=767770&view=rev
Log:
Add support for StopTestNow exception

Added:
    
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JMeterStopTestNowException.java
   (with props)
Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=767770&r1=767769&r2=767770&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java 
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java 
Thu Apr 23 03:02:19 2009
@@ -52,6 +52,7 @@
 import org.apache.jorphan.collections.SearchByClass;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.jorphan.util.JMeterStopTestException;
+import org.apache.jorphan.util.JMeterStopTestNowException;
 import org.apache.jorphan.util.JMeterStopThreadException;
 import org.apache.log.Logger;
 
@@ -248,6 +249,10 @@
         catch (JMeterStopTestException e) {
             log.info("Stopping Test: " + e.toString());
             stopTest();
+        }
+        catch (JMeterStopTestNowException e) {
+            log.info("Stopping Test Now: " + e.toString());
+            stopTestNow();
         } catch (JMeterStopThreadException e) {
             log.info("Stop Thread seen: " + e.toString());
         } catch (Exception e) {
@@ -538,12 +543,19 @@
     private void stopTest() {
         running = false;
         log.info("Stop Test detected by thread: " + threadName);
-        // engine.stopTest();
         if (engine != null) {
             engine.askThreadsToStop();
         }
     }
 
+    private void stopTestNow() {
+        running = false;
+        log.info("Stop Test Now detected by thread: " + threadName);
+        if (engine != null) {
+            engine.stopTest();
+        }
+    }
+
     private void stopThread() {
         running = false;
         log.info("Stop Thread detected by thread: " + threadName);

Added: 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JMeterStopTestNowException.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JMeterStopTestNowException.java?rev=767770&view=auto
==============================================================================
--- 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JMeterStopTestNowException.java
 (added)
+++ 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JMeterStopTestNowException.java
 Thu Apr 23 03:02:19 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jorphan.util;
+
+/**
+ * This Exception is for use by functions etc to signal a Stop Test Now 
condition
+ * where there is no access to the normal stop method
+ *
+ * @version $Revision$
+ */
+public class JMeterStopTestNowException extends RuntimeException {
+    public JMeterStopTestNowException() {
+        super();
+    }
+
+    public JMeterStopTestNowException(String s) {
+        super(s);
+    }
+}

Propchange: 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JMeterStopTestNowException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JMeterStopTestNowException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org

Reply via email to