public void close() { m_log.debug("Closing TCP TURN client."); if (this.m_ioSession != null) { final CloseFuture closeFuture = this.m_ioSession.close(); closeFuture.join(); } }
protected BaseIoSession() { creationTime = lastReadTime = lastWriteTime = lastIdleTimeForBoth = lastIdleTimeForRead = lastIdleTimeForWrite = System .currentTimeMillis(); closeFuture.addListener(SCHEDULED_COUNTER_RESETTER); }
public boolean isClosing() { return closing || closeFuture.isClosed(); }
/** * 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); }
public void close() { if (this.m_ioSession == null) { m_log.debug("Can't close null session"); return; } final CloseFuture future = this.m_ioSession.close(); future.join(); this.m_closed = true; } }
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 } } }
public boolean isConnected() { return !closeFuture.isClosed(); }
session.close().addListener(new IoFutureListener() { public void operationComplete(IoFuture future) { latch.countDown();
@Override public void close() throws IOException { try { flush(); } finally { session.close().join(); } }
@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(); } } }
@Override protected void doClose(IoSession session) { VmPipeSessionImpl s = (VmPipeSessionImpl) session; try { s.getLock().lock(); if (!session.getCloseFuture().isClosed()) { s.getServiceListeners().fireSessionDestroyed(s); s.getRemoteSession().close(); } } finally { s.getLock().unlock(); } }
@Override public void close() throws IOException { m_log.debug("Closing output stream from: "+ThreadUtils.dumpStack()); try { flush(); } finally { m_ioSession.close().join(); } }
final DatagramSessionImpl dgSession = (DatagramSessionImpl) session; final DatagramChannel dgChannel = dgSession.getChannel(); session.close().join(10 * 1000);
final DatagramSessionImpl dgSession = (DatagramSessionImpl) session; final DatagramChannel dgChannel = dgSession.getChannel(); session.close().join(10 * 1000);
private void clear(final IoSession session, final IceStunUdpPeer stunUdpPeer, final IceAgent iceAgent) { log.info("Closing ICE agent"); iceAgent.close(); log.info("Clearing session!!"); final DatagramSessionImpl dgSession = (DatagramSessionImpl) session; final DatagramChannel dgChannel = dgSession.getChannel(); session.close().join(10 * 1000); final StunServer stunServer = stunUdpPeer.getStunServer(); stunServer.close(); try { final IoService service = session.getService(); log.info("Service is: {}", service); if (IoAcceptor.class.isAssignableFrom(service.getClass())) { log.info("Unbinding all!!"); final IoAcceptor acceptor = (IoAcceptor) service; acceptor.unbindAll(); } session.getService().getFilterChain().clear(); dgChannel.disconnect(); dgChannel.close(); } catch (final Exception e) { log.error("Error clearing session!!", e); } finally { stunUdpPeer.close(); } } }