public void unregisterSC(ServerConnection sc) { // removed syncLock synchronization to fix bug 37104 synchronized (this.allSCsLock) { this.allSCs.remove(sc); Iterator it = this.allSCs.iterator(); ServerConnection again[] = new ServerConnection[this.allSCs.size()]; for (int i = 0; i < again.length; i++) { again[i] = (ServerConnection) it.next(); } this.allSCList = again; } if (!isRunning()) { return; } // just need to wake the selector up so it will notice our socket was closed wakeupSelector(); }
public void registerSC(ServerConnection sc) { synchronized (this.syncLock) { if (!isRunning()) { finishCon(sc); return; } } getSelectorQueue().offer(sc); wakeupSelector(); }
private void shutdownSelectorIfIsSelector() { if (isSelector()) { this.hsTimer.cancel(); if (this.tmpSel != null) { try { this.tmpSel.close(); } catch (IOException ignore) { } } try { wakeupSelector(); this.selector.close(); } catch (IOException ignore) { } if (this.selectorThread != null) { this.selectorThread.interrupt(); } this.commBufferQueue.clear(); } }