Author: markt
Date: Mon Dec 6 17:16:53 2010
New Revision: 1042726
URL: http://svn.apache.org/viewvc?rev=1042726&view=rev
Log:
Re-factoring in support of
https://issues.apache.org/bugzilla/show_bug.cgi?id=50360
Pull up timeout getters/setters.
Use -1 consistently for the default value of keepAliveTimeout
Modified:
tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java
tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java?rev=1042726&r1=1042725&r2=1042726&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProtocolHandler.java Mon Dec 6
17:16:53 2010
@@ -200,6 +200,13 @@ public abstract class AbstractProtocolHa
public void setSoLinger(int soLinger) { endpoint.setSoLinger(soLinger); }
+ public int getKeepAliveTimeout() { return endpoint.getKeepAliveTimeout(); }
+ public void setKeepAliveTimeout(int keepAliveTimeout) {
+ endpoint.setKeepAliveTimeout(keepAliveTimeout);
+ }
+
+
+
// ---------------------- Properties that are passed through to the
EndPoint
// ------------------------------------ and are made available as
attributes
@@ -217,6 +224,34 @@ public abstract class AbstractProtocolHa
}
+ /*
+ * When Tomcat expects data from the client, this is the time Tomcat will
+ * wait for that data to arrive before closing the connection.
+ */
+ public int getConnectionTimeout() {
+ // Note that the endpoint uses the alternative name
+ return endpoint.getSoTimeout();
+ }
+ public void setConnectionTimeout(int timeout) {
+ // Note that the endpoint uses the alternative name
+ endpoint.setSoTimeout(timeout);
+ String str = Integer.toString(timeout);
+ setAttribute("connectionTimeout", str);
+ // Also set the attribute for the alternative name
+ setAttribute("soTimeout", str);
+ }
+
+ /*
+ * Alternative name for connectionTimeout property
+ */
+ public int getSoTimeout() {
+ return getConnectionTimeout();
+ }
+ public void setSoTimeout(int timeout) {
+ setConnectionTimeout(timeout);
+ }
+
+
// -------------------------------------------------------- Abstract
methods
/**
* Concrete implementations need to provide access to their logger to be
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java?rev=1042726&r1=1042725&r2=1042726&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java Mon Dec 6
17:16:53 2010
@@ -78,7 +78,6 @@ public abstract class AbstractAjpProtoco
Registry.getRegistry(null, null).unregisterComponent(rgOname);
}
- // *
public String getName() {
String encodedAddr = "";
if (getAddress() != null) {
@@ -90,9 +89,6 @@ public abstract class AbstractAjpProtoco
return ("ajp-" + encodedAddr + endpoint.getPort());
}
- public int getSoTimeout() { return endpoint.getSoTimeout(); }
- public void setSoTimeout(int soTimeout) {
endpoint.setSoTimeout(soTimeout); }
-
/**
* Should authentication be done in the native webserver layer,
* or in the Servlet container ?
@@ -121,14 +117,6 @@ public abstract class AbstractAjpProtoco
}
- /**
- * The number of seconds Tomcat will wait for a subsequent request
- * before closing the connection.
- */
- protected int keepAliveTimeout = -1;
- public int getKeepAliveTimeout() { return keepAliveTimeout; }
- public void setKeepAliveTimeout(int timeout) { keepAliveTimeout = timeout;
}
-
// -------------------- JMX related methods --------------------
protected String domain;
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java?rev=1042726&r1=1042725&r2=1042726&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java Mon Dec 6
17:16:53 2010
@@ -237,7 +237,7 @@ public class AjpProtocol extends Abstrac
processor.setAdapter(proto.adapter);
processor.setTomcatAuthentication(proto.tomcatAuthentication);
processor.setRequiredSecret(proto.requiredSecret);
- processor.setKeepAliveTimeout(proto.keepAliveTimeout);
+ processor.setKeepAliveTimeout(proto.getKeepAliveTimeout());
register(processor);
return processor;
}
Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java?rev=1042726&r1=1042725&r2=1042726&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java Mon
Dec 6 17:16:53 2010
@@ -141,37 +141,6 @@ public abstract class AbstractHttp11Prot
}
/**
- * The number of seconds Tomcat will wait for a subsequent request
- * before closing the connection.
- */
- public void setKeepAliveTimeout(int keepAliveTimeout) {
- endpoint.setKeepAliveTimeout(keepAliveTimeout);
- }
-
- public int getKeepAliveTimeout() {
- return endpoint.getKeepAliveTimeout();
- }
-
- public int getConnectionTimeout() {
- return getSoTimeout();
- }
-
- public void setConnectionTimeout( int timeout ) {
- setSoTimeout(timeout);
- }
-
- public int getSoTimeout() {
- return endpoint.getSoTimeout();
- }
-
- public void setSoTimeout( int i ) {
- endpoint.setSoTimeout(i);
- setAttribute("soTimeout", "" + i);
- setAttribute("connectionTimeout", "" + i);
- }
-
- // *
- /**
* Maximum size of the post which will be saved when processing certain
* requests, such as a POST.
*/
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1042726&r1=1042725&r2=1042726&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Mon Dec
6 17:16:53 2010
@@ -189,9 +189,11 @@ public abstract class AbstractEndpoint {
/**
* Keepalive timeout, if lesser or equal to 0 then soTimeout will be used.
*/
- private int keepAliveTimeout = 0;
- public void setKeepAliveTimeout(int keepAliveTimeout) {
this.keepAliveTimeout = keepAliveTimeout; }
+ private int keepAliveTimeout = -1;
public int getKeepAliveTimeout() { return keepAliveTimeout;}
+ public void setKeepAliveTimeout(int keepAliveTimeout) {
+ this.keepAliveTimeout = keepAliveTimeout;
+ }
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]