You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2001/07/26 06:03:23 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http Constants.java HttpProcessor.java
remm 01/07/25 21:03:23
Modified: catalina/src/share/org/apache/catalina/connector/http
Constants.java HttpProcessor.java
Log:
- Fix for prohibitive shutdown times when using the HTTP/1.1 connector.
- Now, unless the connector has successfully parsed the request line of a new
request, it is not considered active. If the request line is parsed, the connector
will remain in active state until the end of the processing of the request.
- The shutdown method will only wait for 5s before returning if the processor
is in active state.
Revision Changes Path
1.5 +6 -3 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/Constants.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Constants.java 2001/07/22 20:25:07 1.4
+++ Constants.java 2001/07/26 04:03:23 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/Constants.java,v 1.4 2001/07/22 20:25:07 pier Exp $
- * $Revision: 1.4 $
- * $Date: 2001/07/22 20:25:07 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/Constants.java,v 1.5 2001/07/26 04:03:23 remm Exp $
+ * $Revision: 1.5 $
+ * $Date: 2001/07/26 04:03:23 $
*
* ====================================================================
*
@@ -78,5 +78,8 @@
public static final String ServerInfo =
Globals.SERVER_INFO + " (HTTP/1.1 Connector)";
public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;
+
+ public static final int PROCESSOR_IDLE = 0;
+ public static final int PROCESSOR_ACTIVE = 1;
}
1.33 +29 -9 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java
Index: HttpProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- HttpProcessor.java 2001/07/22 20:25:07 1.32
+++ HttpProcessor.java 2001/07/26 04:03:23 1.33
@@ -1,6 +1,6 @@
-/* * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java,v 1.32 2001/07/22 20:25:07 pier Exp $
- * $Revision: 1.32 $
- * $Date: 2001/07/22 20:25:07 $
+/* * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java,v 1.33 2001/07/26 04:03:23 remm Exp $
+ * $Revision: 1.33 $
+ * $Date: 2001/07/26 04:03:23 $
*
* ====================================================================
*
@@ -106,7 +106,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.32 $ $Date: 2001/07/22 20:25:07 $
+ * @version $Revision: 1.33 $ $Date: 2001/07/26 04:03:23 $
*/
final class HttpProcessor
@@ -311,6 +311,12 @@
private HttpRequestLine requestLine = new HttpRequestLine();
+ /**
+ * Processor state
+ */
+ private int status = Constants.PROCESSOR_IDLE;
+
+
// --------------------------------------------------------- Public Methods
@@ -686,6 +692,11 @@
// Parse the incoming request line
input.readRequestLine(requestLine);
+
+ // When the previous method returns, we're actually processing a
+ // request
+ status = Constants.PROCESSOR_ACTIVE;
+
String method =
new String(requestLine.method, 0, requestLine.methodEnd);
String uri = null;
@@ -1022,10 +1033,15 @@
keepAlive = false;
}
+ // End of request processing
+ status = Constants.PROCESSOR_IDLE;
+
// Recycling the request and the response objects
request.recycle();
response.recycle();
+ ok = !stopped;
+
}
try {
@@ -1112,11 +1128,15 @@
stopped = true;
assign(null);
- synchronized (threadSync) {
- try {
- threadSync.wait(5000);
- } catch (InterruptedException e) {
- ;
+
+ if (status != Constants.PROCESSOR_IDLE) {
+ // Only wait if the processor is actually processing a command
+ synchronized (threadSync) {
+ try {
+ threadSync.wait(5000);
+ } catch (InterruptedException e) {
+ ;
+ }
}
}
thread = null;