@Override public void reconfigure(InetSocketAddress addr) { ServerSocketChannel oldSS = ss; try { acceptThread.setReconfiguring(); tryClose(oldSS); acceptThread.wakeupSelector(); try { acceptThread.join(); } catch (InterruptedException e) { LOG.error("Error joining old acceptThread when reconfiguring client port {}", e.getMessage()); Thread.currentThread().interrupt(); } this.ss = ServerSocketChannel.open(); ss.socket().setReuseAddress(true); LOG.info("binding to port " + addr); ss.socket().bind(addr); ss.configureBlocking(false); acceptThread = new AcceptThread(ss, addr, selectorThreads); acceptThread.start(); } catch(IOException e) { LOG.error("Error reconfiguring client port to {} {}", addr, e.getMessage()); tryClose(oldSS); } }