Author: remy.maucherat(a)jboss.com
Date: 2013-11-29 11:40:39 -0500 (Fri, 29 Nov 2013)
New Revision: 2315
Modified:
branches/7.3.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java
branches/7.3.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java
branches/7.3.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
Log:
Port BZ 1035787: Submitted by Ladislav Thon, once paused (and not resumed) the connector
would leak some threads. Visible during testing management mostly.
Modified: branches/7.3.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- branches/7.3.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java 2013-11-29
16:39:53 UTC (rev 2314)
+++ branches/7.3.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java 2013-11-29
16:40:39 UTC (rev 2315)
@@ -1068,13 +1068,16 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
+ if (!running) {
+ break;
+ }
if (reverseConnection) {
if (poller.getConnectionCount() < (maxThreads / 5)) {
@@ -1677,7 +1680,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -1685,7 +1688,7 @@
}
}
// Check timeouts for suspended connections if the poller is empty
- while (connectionCount < 1 && addList.size() < 1) {
+ while (running && connectionCount < 1 &&
addList.size() < 1) {
// Reset maintain time.
try {
if (soTimeout > 0 && running) {
@@ -1700,6 +1703,9 @@
CoyoteLogger.UTIL_LOGGER.errorProcessingSocketTimeout(t);
}
}
+ if (!running) {
+ break;
+ }
try {
// Add sockets which are waiting to the poller
@@ -2259,7 +2265,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -2267,7 +2273,7 @@
}
}
// Loop if poller is empty
- while (sendfileCount < 1 && addS.size() < 1) {
+ while (running && sendfileCount < 1 && addS.size()
< 1) {
// Reset maintain time.
maintainTime = 0;
try {
@@ -2278,6 +2284,9 @@
// Ignore
}
}
+ if (!running) {
+ break;
+ }
try {
// Add socket to the poller
Modified: branches/7.3.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- branches/7.3.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java 2013-11-29
16:39:53 UTC (rev 2314)
+++ branches/7.3.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java 2013-11-29
16:40:39 UTC (rev 2315)
@@ -296,13 +296,16 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
+ if (!running) {
+ break;
+ }
// Accept the next incoming connection from the server socket
try {
@@ -714,7 +717,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -722,7 +725,7 @@
}
}
// Check timeouts for suspended connections if the poller is empty
- while (connectionCount < 1 && addList.size() < 1) {
+ while (running && connectionCount < 1 &&
addList.size() < 1) {
// Reset maintain time.
try {
if (soTimeout > 0 && running) {
@@ -737,6 +740,9 @@
CoyoteLogger.UTIL_LOGGER.errorProcessingSocketTimeout(t);
}
}
+ if (!running) {
+ break;
+ }
try {
Modified: branches/7.3.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
===================================================================
--- branches/7.3.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2013-11-29
16:39:53 UTC (rev 2314)
+++ branches/7.3.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2013-11-29
16:40:39 UTC (rev 2315)
@@ -627,13 +627,16 @@
// Loop until we receive a shutdown command
while (running) {
// Loop if end point is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
+ if (!running) {
+ break;
+ }
try {
// Accept the next incoming connection from the server
@@ -1115,7 +1118,7 @@
public void run() {
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -1604,7 +1607,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Show replies by date