final ThreadModel threadModel = ExecutorThreadModel .getInstance("TCP-TURN-Local-Socket"); connector.getDefaultConfig().setThreadModel(threadModel);
private void buildFilterChain(RegistrationRequest req, IoSession session) throws Exception { getFilterChainBuilder().buildFilterChain(session.getFilterChain()); req.config.getFilterChainBuilder().buildFilterChain( session.getFilterChain()); req.config.getThreadModel().buildFilterChain(session.getFilterChain()); }
((SocketSessionConfig) config.getSessionConfig()).getReceiveBufferSize(); if (receiveBufferSize > 65535) { ch.socket().setReceiveBufferSize(receiveBufferSize);
private void buildFilterChain(RegistrationRequest req, IoSession session) throws Exception { this.getFilterChainBuilder().buildFilterChain(session.getFilterChain()); req.config.getFilterChainBuilder().buildFilterChain( session.getFilterChain()); req.config.getThreadModel().buildFilterChain(session.getFilterChain()); }
ExecutorThreadModel.getInstance( "TCP-Frame-Local-Server-Socket"); connector.getDefaultConfig().setThreadModel(threadModel); final IoHandler ioHandler = new TcpFrameLocalIoHandler(ioSession);
IoSessionConfig sessionConfig = serviceConfig.getSessionConfig(); if (sessionConfig instanceof SocketSessionConfig) { SocketSessionConfig cfg = (SocketSessionConfig) sessionConfig;
getFilterChainBuilder().buildFilterChain( session.getFilterChain()); req.config.getFilterChainBuilder().buildFilterChain( session.getFilterChain()); req.config.getThreadModel().buildFilterChain( session.getFilterChain()); session.getIoProcessor().addNew(session);
ch = DatagramChannel.open(); DatagramSessionConfig cfg; if (req.config.getSessionConfig() instanceof DatagramSessionConfig) { cfg = (DatagramSessionConfig) req.config.getSessionConfig(); } else { cfg = getDefaultConfig().getSessionConfig();
private void newSession(SocketChannel ch, IoHandler handler, IoServiceConfig config, ConnectFuture connectFuture) throws IOException { SocketSessionImpl session = new SocketSessionImpl(this, nextProcessor(), getListeners(), config, ch, handler, ch .socket().getRemoteSocketAddress()); try { getFilterChainBuilder().buildFilterChain(session.getFilterChain()); config.getFilterChainBuilder().buildFilterChain( session.getFilterChain()); config.getThreadModel().buildFilterChain(session.getFilterChain()); } catch (Throwable e) { throw (IOException) new IOException("Failed to create a session.") .initCause(e); } // Set the ConnectFuture of the specified session, which will be // removed and notified by AbstractIoFilterChain eventually. session.setAttribute(AbstractIoFilterChain.CONNECT_FUTURE, connectFuture); // Forward the remaining process to the SocketIoProcessor. session.getIoProcessor().addNew(session); }
ch = DatagramChannel.open(); DatagramSessionConfig cfg; if (config.getSessionConfig() instanceof DatagramSessionConfig) { cfg = (DatagramSessionConfig) config.getSessionConfig(); } else { cfg = getDefaultConfig().getSessionConfig();
IoFilterChain filterChain = localSession.getFilterChain(); this.getFilterChainBuilder().buildFilterChain(filterChain); config.getFilterChainBuilder().buildFilterChain(filterChain); config.getThreadModel().buildFilterChain(filterChain); entry.getAcceptor().getFilterChainBuilder().buildFilterChain( filterChain); entry.getConfig().getFilterChainBuilder().buildFilterChain( filterChain); entry.getConfig().getThreadModel().buildFilterChain(filterChain);
IoSessionConfig sessionConfig = serviceConfig.getSessionConfig(); if (sessionConfig instanceof DatagramSessionConfig) { DatagramSessionConfig cfg = (DatagramSessionConfig) sessionConfig;
private void readSession(DatagramChannel channel, RegistrationRequest req) throws Exception { ByteBuffer readBuf = ByteBuffer .allocate(((DatagramSessionConfig) req.config .getSessionConfig()).getReceiveBufferSize()); try { SocketAddress remoteAddress = channel.receive(readBuf.buf()); if (remoteAddress != null) { DatagramSessionImpl session = (DatagramSessionImpl) newSession( remoteAddress, req.address); readBuf.flip(); ByteBuffer newBuf = ByteBuffer.allocate(readBuf.limit()); newBuf.put(readBuf); newBuf.flip(); session.increaseReadBytes(newBuf.remaining()); session.getFilterChain().fireMessageReceived(session, newBuf); } } finally { readBuf.release(); } }