Author: remy.maucherat(a)jboss.com
Date: 2008-02-26 10:01:53 -0500 (Tue, 26 Feb 2008)
New Revision: 450
Modified:
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
Log:
- Allow sync usage of resume.
- Fix maintain with suspend when there's nothing going on in the server.
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-02-26 13:58:39 UTC
(rev 449)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-02-26 15:01:53 UTC
(rev 450)
@@ -1272,7 +1272,9 @@
readNotifications = false;
} else if (actionCode == ActionCode.ACTION_COMET_RESUME) {
readNotifications = true;
- endpoint.getCometPoller().add(socket, timeout, false, false, true);
+ if (!cometProcessing) {
+ endpoint.getCometPoller().add(socket, timeout, false, false, true);
+ }
} else if (actionCode == ActionCode.ACTION_COMET_WRITE) {
// An event is being processed already:adding for write will be done
// when the socket gets back to the poller
Modified: trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2008-02-26 13:58:39 UTC
(rev 449)
+++ trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2008-02-26 15:01:53 UTC
(rev 450)
@@ -564,8 +564,10 @@
proto.endpoint.getPoller().add(socket);
}
} else {
- proto.endpoint.getCometPoller().add(socket,
result.getCometTimeout(),
- result.getReadNotifications(),
result.getWriteNotification(), false);
+ if (proto.endpoint.isRunning()) {
+ proto.endpoint.getCometPoller().add(socket,
result.getCometTimeout(),
+ result.getReadNotifications(),
result.getWriteNotification(), false);
+ }
}
result.endProcessing();
}
Modified: trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2008-02-26 13:58:39 UTC (rev
449)
+++ trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2008-02-26 15:01:53 UTC (rev
450)
@@ -1463,6 +1463,25 @@
}
/**
+ * Timeout checks.
+ */
+ protected void maintain() {
+
+ long date = System.currentTimeMillis();
+ long socket = timeouts.check(date);
+ while (socket != 0) {
+ removeFromPoller(socket);
+ if (comet) {
+ processSocket(socket, SocketStatus.TIMEOUT);
+ } else {
+ Socket.destroy(socket);
+ }
+ socket = timeouts.check(date);
+ }
+
+ }
+
+ /**
* The background thread that listens for incoming TCP/IP connections and
* hands them off to an appropriate processor.
*/
@@ -1485,10 +1504,15 @@
maintainTime = 0;
try {
synchronized (this) {
- this.wait();
+ this.wait(10000);
}
+ if (soTimeout > 0 && keepAliveCount < 1 &&
addList.size() < 1 && running) {
+ maintain();
+ }
} catch (InterruptedException e) {
// Ignore
+ } catch (Throwable t) {
+ log.error(sm.getString("endpoint.poll.error"), t);
}
}
@@ -1601,17 +1625,7 @@
// This works and uses only one timeout mechanism for everything,
but the
// non Comet poller might be a bit faster by using the old
maintain.
maintainTime = 0;
- long date = System.currentTimeMillis();
- long socket = timeouts.check(date);
- while (socket != 0) {
- removeFromPoller(socket);
- if (comet) {
- processSocket(socket, SocketStatus.TIMEOUT);
- } else {
- Socket.destroy(socket);
- }
- socket = timeouts.check(date);
- }
+ maintain();
}
} catch (Throwable t) {
Show replies by date