NamedPipeSession newSession(NamedPipeAddress localAddress, NamedPipeSession remoteSession) throws Exception { IoHandler handler = bindings.get(localAddress); if (handler == null) { throw new IOException(String.format("Named pipe \"%s\" not bound", localAddress.getPipeName())); } NamedPipeSession session = new NamedPipeSession(this, processor, localAddress, handler); IoFilterChain chain = session.getFilterChain(); IoFilterChainBuilder builder = getFilterChainBuilder(); builder.buildFilterChain(chain); initSession(session, null, null); session.setRemoteSession(remoteSession); getListeners().fireSessionCreated(session); return session; } }
private IoSession newSessionWithoutLock(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception { DatagramChannel handle = boundHandles.get(localAddress); if (handle == null) { throw new IllegalArgumentException("Unknown local address: " + localAddress); } IoSession session; synchronized (sessionRecycler) { session = sessionRecycler.recycle(remoteAddress); if (session != null) { return session; } // If a new session needs to be created. NioSession newSession = newSession(this, handle, remoteAddress); getSessionRecycler().put(newSession); session = newSession; } initSession(session, null, null); try { this.getFilterChainBuilder().buildFilterChain(session.getFilterChain()); getListeners().fireSessionCreated(session); } catch (Exception e) { ExceptionMonitor.getInstance().exceptionCaught(e); } return session; }
private IoSession newSessionWithoutLock(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception { DatagramChannel handle = boundHandles.get(localAddress); if (handle == null) { throw new IllegalArgumentException("Unknown local address: " + localAddress); } IoSession session; synchronized (sessionRecycler) { session = sessionRecycler.recycle(remoteAddress); if (session != null) { return session; } // If a new session needs to be created. NioSession newSession = newSession(this, handle, remoteAddress); getSessionRecycler().put(newSession); session = newSession; } initSession(session, null, null); try { this.getFilterChainBuilder().buildFilterChain(session.getFilterChain()); getListeners().fireSessionCreated(session); } catch (Exception e) { ExceptionMonitor.getInstance().exceptionCaught(e); } return session; }
private IoSession newSessionWithoutLock( SocketAddress remoteAddress, SocketAddress localAddress) throws Exception { H handle = boundHandles.get(localAddress); if (handle == null) { throw new IllegalArgumentException("Unknown local address: " + localAddress); } IoSession session; IoSessionRecycler sessionRecycler = getSessionRecycler(); synchronized (sessionRecycler) { session = sessionRecycler.recycle(localAddress, remoteAddress); if (session != null) { return session; } // If a new session needs to be created. T newSession = newSession(processor, handle, remoteAddress); getSessionRecycler().put(newSession); session = newSession; } initSession(session, null, null); try { this.getFilterChainBuilder().buildFilterChain(session.getFilterChain()); getListeners().fireSessionCreated(session); } catch (Throwable t) { ExceptionMonitor.getInstance().exceptionCaught(t); } return session; }
private IoSessionEx newSessionWithoutLock( SocketAddress remoteAddress, SocketAddress localAddress) throws Exception { Handle handle = boundHandles.get(localAddress); if (handle == null) { throw new IllegalArgumentException("Unknown local address: " + localAddress); } IoSessionEx session; IoSessionRecycler sessionRecycler = getSessionRecycler(); synchronized (sessionRecycler) { session = (IoSessionEx) sessionRecycler.recycle(localAddress, remoteAddress); if (session != null && !session.isClosing()) { return session; } // If a new session needs to be created. MulticastSession newSession = new MulticastSession(this, processor, handle.socket, handle.localAddress, remoteAddress); sessionRecycler.put(newSession); session = newSession; } initSession(session, null, null); try { this.getFilterChainBuilder().buildFilterChain(session.getFilterChain()); getListeners().fireSessionCreated(session); } catch (Throwable t) { ExceptionMonitor.getInstance().exceptionCaught(t, session); } return session; }
protected T newSession(IoSessionInitializer<? extends IoFuture> initializer, IoFuture future, Callable<T> sessionCreator) throws Exception { T session; IoProcessorEx<T> processor = getProcessor(); synchronized (processor) { session = sessionCreator.call(); processor.add(session); } initSession(session, future, initializer); IoFilterChain filterChain = session.getFilterChain(); try { this.getFilterChainBuilder().buildFilterChain(filterChain); } catch (Throwable t) { ExceptionMonitor.getInstance().exceptionCaught(t, session); } addLoggerFilter(session, getLogger()); getListeners().fireSessionCreated(session); return session; }
@Override public void add(MulticastSession session) { boolean notified = false; try { // Build the filter chain of this session. session.getService().getFilterChainBuilder().buildFilterChain( session.getFilterChain()); // DefaultIoFilterChain.CONNECT_FUTURE is cleared inside here // in AbstractIoFilterChain.fireSessionOpened(). session.getService().getListeners() .fireSessionCreated(session); notified = true; } catch (Throwable e) { if (notified) { // Clear the DefaultIoFilterChain.CONNECT_FUTURE attribute // and call ConnectFuture.setException(). session.close(true); IoFilterChain filterChain = session.getFilterChain(); filterChain.fireExceptionCaught(e); } else { ExceptionMonitor.getInstance().exceptionCaught(e, session); } } }
private void addNow(ChannelIoSession<? extends ChannelConfig> session) { try { init(session); // Build the filter chain of this session. IoFilterChainBuilder chainBuilder = session.getService().getFilterChainBuilder(); chainBuilder.buildFilterChain(session.getFilterChain()); // DefaultIoFilterChain.CONNECT_FUTURE is cleared inside here // in AbstractIoFilterChain.fireSessionOpened(). // Propagate the SESSION_CREATED event up to the chain IoServiceListenerSupport listeners = session.getService().getListeners(); listeners.fireSessionCreated(session); } catch (Throwable e) { ExceptionMonitor.getInstance().exceptionCaught(e, session); try { destroy(session); } catch (Exception e1) { ExceptionMonitor.getInstance().exceptionCaught(e1, session); } } }
getListeners().fireSessionCreated(localSession); idleChecker.addSession(localSession); } catch (Exception e) { entry.getListeners().fireSessionCreated(remoteSession); idleChecker.addSession(remoteSession); } catch (Exception e) {
getListeners().fireSessionCreated(localSession); idleChecker.addSession(localSession); } catch (Throwable t) { entry.getListeners().fireSessionCreated(remoteSession); idleChecker.addSession(remoteSession); } catch (Throwable t) {
getListeners().fireSessionCreated(localSession); idleChecker.addSession(localSession); } catch (Exception e) { entry.getListeners().fireSessionCreated(remoteSession); idleChecker.addSession(remoteSession); } catch (Exception e) {
bridgeSessionInitializer.initializeSession(tcpBridgeSession, bridgeConnectFuture); connector.getFilterChainBuilder().buildFilterChain(tcpBridgeSession.getFilterChain()); connector.getListeners().fireSessionCreated(tcpBridgeSession); return tcpBridgeSession;
localSession.setRemoteSession(remoteSession); getListeners().fireSessionCreated(localSession);
.fireSessionCreated(session); notified = true; } catch (Throwable e) {
acceptor.getListeners().fireSessionCreated(newTcpBridgeSession);