private void destroyReaderThread(EventHandler eventHandler) { if (orb.transportDebugFlag) { dprint(".destroyReaderThread: " + eventHandler); } ReaderThread readerThread = (ReaderThread) readerThreads.get(eventHandler); if (readerThread == null) { if (orb.transportDebugFlag) { dprint(".destroyReaderThread: cannot find ReaderThread - ignoring."); } return; } readerThreads.remove(eventHandler); readerThread.close(); }
public void close() { if (orb.transportDebugFlag) { dprint(".close"); } if (isClosed()) { if (orb.transportDebugFlag) { dprint(".close: already closed"); } return; } setClosed(true); Iterator i; // Kill listeners. i = listenerThreads.values().iterator(); while (i.hasNext()) { ListenerThread listenerThread = (ListenerThread) i.next(); listenerThread.close(); } // Kill readers. i = readerThreads.values().iterator(); while (i.hasNext()) { ReaderThread readerThread = (ReaderThread) i.next(); readerThread.close(); } // Selector try { if (selector != null) { // wakeup Selector thread to process close request selector.wakeup(); } } catch (Throwable t) { if (orb.transportDebugFlag) { dprint(".close: selector.close: " + t); } } }