/** * Implement this method to perform real close operation. * By default, this method is implemented to set the future to * 'closed' immediately. */ protected void close0() { closeFuture.setClosed(); }
public void fireSessionClosed(IoSession session) { // Update future. try { session.getCloseFuture().setClosed(); } catch (Throwable t) { fireExceptionCaught(session, t); } // And start the chain. Entry head = this.head; callNextSessionClosed(head, session); }
private void cancelKeys() { if (cancelQueue.isEmpty()) return; Selector selector = this.selector; for (;;) { DatagramSessionImpl session = cancelQueue.poll(); if (session == null) break; else { SelectionKey key = session.getSelectionKey(); DatagramChannel ch = (DatagramChannel) key.channel(); try { ch.disconnect(); ch.close(); } catch (IOException e) { ExceptionMonitor.getInstance().exceptionCaught(e); } getListeners().fireSessionDestroyed(session); session.getCloseFuture().setClosed(); key.cancel(); selector.wakeup(); // wake up again to trigger thread death } } }
@Override protected void doClose(IoSession session) { DatagramSessionImpl s = (DatagramSessionImpl) session; DatagramService manager = s.getManagerDelegate(); if (manager instanceof DatagramConnectorDelegate) { manager.closeSession(s); } else { ((DatagramAcceptorDelegate) manager).getListeners() .fireSessionDestroyed(session); session.getCloseFuture().setClosed(); } } }