private void run() { while (serverChannel.isOpen()) { try { parent.addConnection(new Connection(parent, owner, serverChannel.accept())); parent.sync(); } catch (ClosedChannelException ignore) { } catch (Exception e) { log.log(Level.WARNING, "Error accepting connection", e); } } while (true) { try { shutdownGate.await(); return; } catch (InterruptedException ignore) {} } }