Author: aogburn
Date: 2013-08-16 11:52:25 -0400 (Fri, 16 Aug 2013)
New Revision: 2248
Modified:
branches/2.1.x/java/org/apache/tomcat/util/net/JIoEndpoint.java
Log:
[JBWEB-278] backport from AS7-3834: fix unlockAccept shutdown hang
Modified: branches/2.1.x/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- branches/2.1.x/java/org/apache/tomcat/util/net/JIoEndpoint.java 2013-08-15 06:34:09
UTC (rev 2247)
+++ branches/2.1.x/java/org/apache/tomcat/util/net/JIoEndpoint.java 2013-08-16 15:52:25
UTC (rev 2248)
@@ -20,6 +20,7 @@
import java.io.IOException;
import java.net.BindException;
import java.net.InetAddress;
+import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.Executor;
@@ -586,17 +587,18 @@
* Unlock the accept by using a local connection.
*/
protected void unlockAccept() {
- Socket s = null;
+ java.net.Socket s = null;
+ InetSocketAddress saddr = null;
try {
// Need to create a connection to unlock the accept();
if (address == null) {
- s = new Socket("localhost", port);
+ saddr = new InetSocketAddress("localhost", port);
} else {
- s = new Socket(address, port);
- // setting soLinger to a small value will help shutdown the
- // connection quicker
- s.setSoLinger(true, 0);
+ saddr = new InetSocketAddress(address, port);
}
+ s = new java.net.Socket();
+ s.setSoLinger(true, 0);
+ s.connect(saddr, 2000);
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("endpoint.debug.unlock", "" +
port), e);
Property changes on: branches/2.1.x/java/org/apache/tomcat/util/net/JIoEndpoint.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.2.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java:2135
Show replies by date