Source:
<code>public void select(final int delay) { ArgumentVerifier.assertNotNegative(delay, "delay"); checkRunning(); long startTime = delay == 0 ? -1 : Clock.accurateForwardProgressingMillis(); do { if (wakeUp) { break; } try { commonSelector.selectNow(); localNoThreadScheduler.tick(null); commonSelector.select(Math.min(delay, 50)); if(isRunning()) { for(final SelectionKey key: commonSelector.selectedKeys()) { try { if(key.isAcceptable()) { doServerAccept(servers.get(key.channel())); } else { final Client tmpClient = clients.get(key.channel()); if(key.isConnectable() && tmpClient != null) { doClientConnect(tmpClient, commonSelector); key.cancel(); setClientOperations(tmpClient); } else { if (key.isReadable()) { if(tmpClient != null){ doClientRead(tmpClient, commonSelector); } else { final Server server = servers.get(key.channel()); if(server != null && server.getServerType() == WireProtocol.UDP) { server.acceptChannel((DatagramChannel)server.getSelectableChannel()); } } } if(key.isWritable()) { if(tmpClient != null){ doClientWrite(tmpClient, commonSelector); } else { final Server server = servers.get(key.channel()); if(server != null) { if(server instanceof UDPServer) { UDPServer us = (UDPServer) server; stats.addWrite(us.doWrite()); setUDPServerOperations(us, true); } } } } } } } catch(CancelledKeyException e) { } } commonSelector.selectNow(); localNoThreadScheduler.tick(null); } } catch (IOException e) { } catch(ClosedSelectorException e) { } catch (NullPointerException e) { } <START> } while ((delay == 0 ? Clock.lastKnownForwardProgressingMillis() : Clock.accurateForwardProgressingMillis()) - startTime <= delay && isRunning()); <END> wakeUp = false; }</code><technical_language>call Clock if delay==0</technical_language>

Target:
public void select(final int delay) { ArgumentVerifier.assertNotNegative(delay, "delay"); checkRunning(); long startTime = delay == 0 ? -1 : Clock.accurateForwardProgressingMillis(); do { if (wakeUp) { break; } try { commonSelector.selectNow(); localNoThreadScheduler.tick(null); commonSelector.select(Math.min(delay, 50)); if(isRunning()) { for(final SelectionKey key: commonSelector.selectedKeys()) { try { if(key.isAcceptable()) { doServerAccept(servers.get(key.channel())); } else { final Client tmpClient = clients.get(key.channel()); if(key.isConnectable() && tmpClient != null) { doClientConnect(tmpClient, commonSelector); key.cancel(); setClientOperations(tmpClient); } else { if (key.isReadable()) { if(tmpClient != null){ doClientRead(tmpClient, commonSelector); } else { final Server server = servers.get(key.channel()); if(server != null && server.getServerType() == WireProtocol.UDP) { server.acceptChannel((DatagramChannel)server.getSelectableChannel()); } } } if(key.isWritable()) { if(tmpClient != null){ doClientWrite(tmpClient, commonSelector); } else { final Server server = servers.get(key.channel()); if(server != null) { if(server instanceof UDPServer) { UDPServer us = (UDPServer) server; stats.addWrite(us.doWrite()); setUDPServerOperations(us, true); } } } } } } } catch(CancelledKeyException e) { } } commonSelector.selectNow(); localNoThreadScheduler.tick(null); } } catch (IOException e) { } catch(ClosedSelectorException e) { } catch (NullPointerException e) { } } while ((delay == 0 ? 0 : Clock.accurateForwardProgressingMillis()) - startTime <= delay && isRunning()); wakeUp = false; }