@Override public IPromise closeServer() { try { clientSockets.forEach( socket -> { // need to give time for flush. No way to determine wether buffers are out => // risk of premature close + message loss Actors.SubmitDelayed(DELAY_MS_TILL_CLOSE, () -> { try { socket.close(); } catch (IOException e) { Log.Warn(this, e); } }); }); acceptSocket.close(); } catch (IOException e) { return new Promise<>(null,e); } return new Promise<>(null); }
@Override public IPromise closeServer() { try { clientSockets.forEach( socket -> { // need to give time for flush. No way to determine wether buffers are out => // risk of premature close + message loss Actors.SubmitDelayed(DELAY_MS_TILL_CLOSE, () -> { try { socket.close(); } catch (IOException e) { Log.Warn(this, e); } }); }); acceptSocket.close(); } catch (IOException e) { return new Promise<>(null,e); } return new Promise<>(null); }
Actors.SubmitDelayed(TCPServerConnector.DELAY_MS_TILL_CLOSE, () -> { selector.selectedKeys().forEach(key -> { try {
Actors.SubmitDelayed(TCPServerConnector.DELAY_MS_TILL_CLOSE, () -> { selector.selectedKeys().forEach(key -> { try {