remm 2003/10/04 11:05:29
Modified: util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
Log:
- No bug fix !
- Use the appropriate exception for killing the thread,
- Improve ifs.
- Replace while + break with a simpler (IMO) if.
- Please let me know ASAP if there's a problem.
Revision Changes Path
1.21 +17 -18 jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java
Index: PoolTcpEndpoint.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- PoolTcpEndpoint.java 3 Oct 2003 10:48:45 -0000 1.20
+++ PoolTcpEndpoint.java 4 Oct 2003 18:05:29 -0000 1.21
@@ -369,12 +369,16 @@
} else {
accepted = factory.acceptSocket(serverSocket);
}
- if(!running && (null != accepted)) {
+ if (null == accepted) {
+ log.warn("Null socket returned by accept");
+ } else {
+ if (!running) {
accepted.close(); // rude, but unlikely!
accepted = null;
+ } else if (factory != null) {
+ factory.initSocket( accepted );
+ }
}
- if( factory != null && accepted != null)
- factory.initSocket( accepted );
}
catch(InterruptedIOException iioe) {
// normal part -- should happen regularly so
@@ -533,20 +537,17 @@
public void runIt(Object perThrData[]) {
// Create per-thread cache
- while(endpoint.isRunning()) {
+ if (endpoint.isRunning()) {
Socket s = null;
try {
s = endpoint.acceptSocket();
- } catch (ThreadDeath t) {
- endpoint.log.error("Shutdown thread: "
- + Thread.currentThread().getName());
- throw t;
- } catch (Throwable t) {
- endpoint.log.error("Exception in acceptSocket", t);
- }
- if(null != s) {
+ } finally {
// Continue accepting on another thread...
- endpoint.tp.runIt(this);
+ if (endpoint.isRunning()) {
+ endpoint.tp.runIt(this);
+ }
+ }
+ if (null != s) {
try {
if(endpoint.getServerSocketFactory()!=null) {
@@ -558,7 +559,6 @@
try {
s.close();
} catch (IOException e) {}
- break;
}
TcpConnection con = null;
@@ -590,7 +590,6 @@
}
}
}
- break;
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
|