https://issues.apache.org/bugzilla/show_bug.cgi?id=52768
Bug #: 52768 Summary: Potential Bug or Inconsistency in AprEndpoint.java and JIoEndpoint.java Product: Tomcat 7 Version: trunk Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Catalina AssignedTo: dev@tomcat.apache.org ReportedBy: msrbugzi...@gmail.com Classification: Unclassified This is Ken Cheung, a Computer Science M.Phil. student. I observed some code clones in Tomcat and found inconsistent code: /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 1048 try { 1049 Thread.sleep(1000); 1050 } catch (InterruptedException e) { 1051 // Ignore 1052 } 1053 long now = System.currentTimeMillis(); 1054 Iterator<SocketWrapper<Long>> sockets = 1055 waitingRequests.iterator(); 1056 while (sockets.hasNext()) { 1057 SocketWrapper<Long> socket = sockets.next(); 1058 if (socket.async) { 1059 long access = socket.getLastAccess(); 1060 if (socket.getTimeout() > 0 && 1061 (now-access)>socket.getTimeout()) { 1062 processSocketAsync(socket,SocketStatus.TIMEOUT); 1063 } 1064 } 1065 } /tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 147 try { 148 Thread.sleep(1000); 149 } catch (InterruptedException e) { 150 // Ignore 151 } 152 long now = System.currentTimeMillis(); 153 Iterator<SocketWrapper<Socket>> sockets = 154 waitingRequests.iterator(); 155 while (sockets.hasNext()) { 156 SocketWrapper<Socket> socket = sockets.next(); 157 long access = socket.getLastAccess(); 158 if (socket.getTimeout() > 0 && 159 (now-access)>socket.getTimeout()) { 160 processSocketAsync(socket,SocketStatus.TIMEOUT); 161 } 162 } Quick description of the inconsistency Two code snippets are very similar code, but as you see, in JIoEndpoint.java does not check "if (socket.async)" while AprEndpoint.java has the checker. We thought it could be a potential bug or inconsistency. Hope this helps. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org