I observed some code clones in Tomcat and found inconsistent code. Could anyone explain why this is not a bug?
/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.