Author: remm
Date: Wed Nov 29 08:19:23 2006
New Revision: 480612
URL: http://svn.apache.org/viewvc?view=rev&rev=480612
Log:
- For consistency, add keepAliveTimeout to this protocol handler.
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?view=diff&rev=480612&r1=480611&r2=480612
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Wed Nov
29 08:19:23 2006
@@ -327,6 +327,16 @@
public void setRequiredSecret(String requiredSecret) { this.requiredSecret
= requiredSecret; }
+ /**
+ * The number of milliseconds Tomcat will wait for a subsequent request
+ * before closing the connection. The default is the same as for
+ * Apache HTTP Server (15 000 milliseconds).
+ */
+ protected int keepAliveTimeout = -1;
+ public int getKeepAliveTimeout() { return keepAliveTimeout; }
+ public void setKeepAliveTimeout(int timeout) { keepAliveTimeout = timeout;
}
+
+
// --------------------------------------------------------- Public Methods
@@ -354,6 +364,10 @@
this.socket = socket;
input = socket.getInputStream();
output = socket.getOutputStream();
+ int soTimeout = -1;
+ if (keepAliveTimeout > 0) {
+ soTimeout = socket.getSoTimeout();
+ }
// Error flag
error = false;
@@ -362,11 +376,19 @@
// Parsing the request header
try {
+ // Set keep alive timeout if enabled
+ if (keepAliveTimeout > 0) {
+ socket.setSoTimeout(keepAliveTimeout);
+ }
// Get first message of the request
if (!readMessage(requestHeaderMessage)) {
// This means a connection timeout
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
break;
+ }
+ // Set back timeout if keep alive timeout is enabled
+ if (keepAliveTimeout > 0) {
+ socket.setSoTimeout(soTimeout);
}
// Check message type, process right away and break if
// not regular request processing
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java?view=diff&rev=480612&r1=480611&r2=480612
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java Wed Nov 29
08:19:23 2006
@@ -389,6 +389,16 @@
}
+ /**
+ * The number of seconds Tomcat will wait for a subsequent request
+ * before closing the connection. The default is the same as for
+ * Apache HTTP Server (15 000 milliseconds).
+ */
+ protected int keepAliveTimeout = -1;
+ public int getKeepAliveTimeout() { return keepAliveTimeout; }
+ public void setKeepAliveTimeout(int timeout) { keepAliveTimeout = timeout;
}
+
+
// -------------------------------------- AjpConnectionHandler Inner Class
@@ -411,6 +421,7 @@
processor.setAdapter(proto.adapter);
processor.setTomcatAuthentication(proto.tomcatAuthentication);
processor.setRequiredSecret(proto.requiredSecret);
+ processor.setKeepAliveTimeout(proto.keepAliveTimeout);
localProcessor.set(processor);
if (proto.getDomain() != null) {
synchronized (this) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]