You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/11/25 14:24:35 UTC

svn commit: r1039031 - in /jakarta/jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java xdocs/changes.xml

Author: sebb
Date: Thu Nov 25 13:24:35 2010
New Revision: 1039031

URL: http://svn.apache.org/viewvc?rev=1039031&view=rev
Log:
AJP Sampler now implements Interruptible

Modified:
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java?rev=1039031&r1=1039030&r2=1039031&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java Thu Nov 25 13:24:35 2010
@@ -32,6 +32,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.Header;
 import org.apache.jmeter.protocol.http.control.HeaderManager;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
+import org.apache.jmeter.samplers.Interruptible;
 import org.apache.jmeter.testelement.property.CollectionProperty;
 import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.PropertyIterator;
@@ -46,7 +47,7 @@ import org.apache.log.Logger;
  * actually having Apache installed and configured
  *
  */
-public class AjpSampler extends HTTPSamplerBase {
+public class AjpSampler extends HTTPSamplerBase implements Interruptible {
 
     private static final long serialVersionUID = 233L;
 
@@ -83,6 +84,7 @@ public class AjpSampler extends HTTPSamp
     static final int MAX_SEND_SIZE = 8*1024 - 4 - 4;
 
     private transient Socket channel = null;
+    private transient Socket activeChannel = null;
     private int lastPort = -1;
     private String lastHost = null;
     private String localName = null;
@@ -109,6 +111,7 @@ public class AjpSampler extends HTTPSamp
         res.sampleStart();
         try {
             setupConnection(url, method, res);
+            activeChannel = channel;
             execute(method, res);
             res.sampleEnd();
             res.setResponseData(responseData.toByteArray());
@@ -119,6 +122,8 @@ public class AjpSampler extends HTTPSamp
             lastPort = -1; // force reopen on next sample
             channel = null;
             return err;
+        } finally {
+            activeChannel = null;
         }
     }
 
@@ -500,4 +505,17 @@ public class AjpSampler extends HTTPSamp
         inpos+= len+1;
         return s;
     }
+
+    public boolean interrupt() {
+        Socket chan = activeChannel;
+        if (chan != null) {
+            activeChannel = null;
+            try {
+                chan.close();
+            } catch (Exception e) {
+                // Ignored
+            }
+        }
+        return chan != null;
+    }
 }

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1039031&r1=1039030&r2=1039031&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Nov 25 13:24:35 2010
@@ -123,6 +123,7 @@ Also enable reversion to using System.cu
 
 <h3>HTTP Samplers</h3>
 <ul>
+<li>AJP Sampler now implements Interruptible</li>
 </ul>
 
 <h3>Other samplers</h3>



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org