Author: markt
Date: Tue May 26 09:50:33 2015
New Revision: 1681729
URL: http://svn.apache.org/r1681729
Log:
Fix 1000 second timeout observed by rjung in unit tests.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1681729&r1=1681728&r2=1681729&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Tue May 26
09:50:33 2015
@@ -1302,7 +1302,8 @@ public class AprEndpoint extends Abstrac
/**
- * Last run of maintain. Maintain will run usually every 5s.
+ * Last run of maintain. Maintain will run approximately once every one
+ * second (may be slightly longer between runs).
*/
private long lastMaintain = System.currentTimeMillis();
@@ -1600,7 +1601,6 @@ public class AprEndpoint extends Abstrac
@Override
public void run() {
- int maintain = 0;
SocketList localAddList = new SocketList(getMaxConnections());
SocketList localCloseList = new SocketList(getMaxConnections());
@@ -1618,7 +1618,6 @@ public class AprEndpoint extends Abstrac
// Check timeouts if the poller is empty.
while (pollerRunning && connectionCount.get() < 1 &&
addList.size() < 1 && closeList.size() < 1) {
- // Reset maintain time.
try {
if (getSoTimeout() > 0 && pollerRunning) {
maintain();
@@ -1888,24 +1887,21 @@ public class AprEndpoint extends Abstrac
}
}
-
+ } catch (Throwable t) {
+ ExceptionUtils.handleThrowable(t);
+ getLog().warn(sm.getString("endpoint.poll.error"), t);
+ }
+ try {
// Process socket timeouts
- if (getSoTimeout() > 0 && maintain++ > 1000 &&
pollerRunning) {
+ if (getSoTimeout() > 0 && pollerRunning) {
// This works and uses only one timeout mechanism for
everything, but the
// non event poller might be a bit faster by using the
old maintain.
- maintain = 0;
maintain();
}
-
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- if (maintain == 0) {
- getLog().warn(sm.getString("endpoint.timeout.error"),
t);
- } else {
- getLog().warn(sm.getString("endpoint.poll.error"), t);
- }
+ getLog().warn(sm.getString("endpoint.timeout.error"), t);
}
-
}
synchronized (this) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]