org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder Java Examples

The following examples show how to use org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NetManager.java    From GameServer with Apache License 2.0 6 votes vote down vote up
public  void startListner(IoHandler iohandler,int listenPort) throws Exception{
	acceptor = new NioSocketAcceptor();
	acceptor.setBacklog(100);
	acceptor.setReuseAddress(true);
	acceptor.setHandler(iohandler);
	
       DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
       IoFilter protocol = new ProtocolCodecFilter(new GameProtocolcodecFactory());
       chain.addLast("codec", protocol);
	threadpool = new OrderedThreadPoolExecutor(500);
	threadpool.setThreadFactory(new ServerThreadFactory("OrderedThreadPool"));
	chain.addLast("threadPool", new ExecutorFilter(threadpool));
	
	int recsize = 5120;
	int sendsize = 40480;                                                                                         
	int timeout = 10;
	SocketSessionConfig sc = acceptor.getSessionConfig();
	sc.setReuseAddress(true);// 设置每一个非主监听连接的端口可以重用
	sc.setReceiveBufferSize(recsize);// 设置输入缓冲区的大小
	sc.setSendBufferSize(sendsize);// 设置输出缓冲区的大小
	sc.setTcpNoDelay(true);// flush函数的调用 设置为非延迟发送,为true则不组装成大包发送,收到东西马上发出   
	sc.setSoLinger(0);
	sc.setIdleTime(IdleStatus.READER_IDLE, timeout);
	acceptor.bind(new InetSocketAddress(listenPort));
}
 
Example #2
Source File: ITCHTcpClient.java    From sailfish-core with Apache License 2.0 6 votes vote down vote up
@Override
protected void initFilterChain(DefaultIoFilterChainBuilder filterChain) throws Exception {
    super.initFilterChain(filterChain);

    if(getSettings().isCompressionUsed()) {
        getCodecSettings().setChunkDelimiter(ByteBuffer.allocate(2).putShort((short)getSettings().getCompressedChunkDelimeter()).array());

        // ProtocolCodecFilter stores ProtocolDecoderOutput in session. So if we use more then one ProtocolCodecFilter
        // ProtocolDecoderOutput instance will be shared between all of them.
        // Hacked filter does not store ProtocolDecoderOutput instance in session
        CodecFactory codecFactory = new CodecFactory(serviceContext, messageFactory, null, ITCHDeflateCodec.class, getCodecSettings());
        HackedProtocolCodecFilter decompressorFilter = new HackedProtocolCodecFilter(codecFactory);

        filterChain.addBefore("codec", "decompressor", decompressorFilter);
    }
}
 
Example #3
Source File: MinaTcpClient.java    From game-server with MIT License 6 votes vote down vote up
/**
   * 初始化tcp连接
   * @param clientProtocolHandler
   */
  private void init(IoHandler clientProtocolHandler) {
      connector = new NioSocketConnector();
      DefaultIoFilterChainBuilder chain = connector.getFilterChain();
      chain.addLast("codec", codecFilter);
      if(filters != null){
          filters.forEach((key, filter)->{
		if("ssl".equalsIgnoreCase(key) || "tls".equalsIgnoreCase(key)){	//ssl过滤器必须添加到首部
			chain.addFirst(key, filter);
		}else{
			chain.addLast(key, filter);
		}
	});
}
      connector.setHandler(clientProtocolHandler);
      connector.setConnectTimeoutMillis(60000L);
      connector.setConnectTimeoutCheckInterval(10000);
  }
 
Example #4
Source File: LdapsInitializer.java    From MyVirtualDirectory with Apache License 2.0 6 votes vote down vote up
public static IoFilterChainBuilder init( LdapServer server ) throws LdapException
{
    SSLContext sslCtx;
    try
    {
    	sslCtx = server.getSSLContext();
    	
    }
    catch ( Exception e )
    {
        throw new LdapException( I18n.err( I18n.ERR_683 ), e );
    }

    DefaultIoFilterChainBuilder chain = new DefaultIoFilterChainBuilder();
    SslFilter sslFilter = new SslFilter( sslCtx );

    List<String> cipherSuites = server.getEnabledCipherSuites();
    if( ( cipherSuites != null ) && !cipherSuites.isEmpty() )
    {
        sslFilter.setEnabledCipherSuites( cipherSuites.toArray( new String[cipherSuites.size()] ) );
    }
    
    sslFilter.setWantClientAuth( true );
    chain.addLast( "sslFilter", sslFilter );
    return chain;
}
 
Example #5
Source File: CrossServer.java    From jforgame with Apache License 2.0 6 votes vote down vote up
/**
 * start Mina serversocket
 * @throws Exception
 */
@Override
public void start() throws Exception {
	final int serverPort = ServerConfig.getInstance().getCrossPort();
	IoBuffer.setUseDirectBuffer(false);
	IoBuffer.setAllocator(new SimpleBufferAllocator());

	acceptor = new NioSocketAcceptor(pool);
	acceptor.setReuseAddress(true);
	acceptor.getSessionConfig().setAll(getSessionConfig());

	logger.info("cross server start at port:{},正在监听服务器点对点的连接...", serverPort);
	DefaultIoFilterChainBuilder filterChain = acceptor.getFilterChain();
	filterChain.addLast("codec",
			new ProtocolCodecFilter(SerializerHelper.getInstance().getCodecFactory()));
	//指定业务逻辑处理器
	acceptor.setHandler(new Game2GameIoHandler(BaseCrossMessageDispatcher.getInstance()));
	//设置端口号
	acceptor.setDefaultLocalAddress(new InetSocketAddress(serverPort));
	//启动监听
	acceptor.bind();
}
 
Example #6
Source File: MinaSocketServer.java    From jforgame with Apache License 2.0 6 votes vote down vote up
/**
 * start Mina serversocket
 * @throws Exception
 */
@Override
public void start() throws Exception {
	int serverPort = ServerConfig.getInstance().getServerPort();
	IoBuffer.setUseDirectBuffer(false);
	IoBuffer.setAllocator(new SimpleBufferAllocator());

	acceptor = new NioSocketAcceptor(pool);
	acceptor.setReuseAddress(true);
	acceptor.getSessionConfig().setAll(getSessionConfig());

	logger.info("mina socket server start at port:{},正在监听客户端的连接...", serverPort);
	DefaultIoFilterChainBuilder filterChain = acceptor.getFilterChain();
	filterChain.addLast("codec",
			new ProtocolCodecFilter(SerializerHelper.getInstance().getCodecFactory()));
	filterChain.addLast("moduleEntrance", new ModuleEntranceFilter());
	filterChain.addLast("msgTrace", new MessageTraceFilter());
	filterChain.addLast("flood", new FloodFilter());
	//指定业务逻辑处理器
	acceptor.setHandler(new ServerSocketIoHandler(new MessageDispatcher()));
	//设置端口号
	acceptor.setDefaultLocalAddress(new InetSocketAddress(serverPort));
	//启动监听
	acceptor.bind();
}
 
Example #7
Source File: TCPIPClient.java    From sailfish-core with Apache License 2.0 5 votes vote down vote up
@Override
protected void initFilterChain(DefaultIoFilterChainBuilder filterChain) throws Exception {
    super.initFilterChain(filterChain);

    if(getSettings().isUseSSL()) {
        filterChain.addFirst("SSLFilter", MINAUtil.createSslFilter(true, getSettings().getSslProtocol(), null, null, null));
    }
}
 
Example #8
Source File: HttpServer.java    From game-server with MIT License 5 votes vote down vote up
@Override
public void run() {
	DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
	chain.addLast("codec", new HttpServerCodecImpl());

	// // 线程队列池
	OrderedThreadPoolExecutor threadpool = new OrderedThreadPoolExecutor(minaServerConfig.getOrderedThreadPoolExecutorSize());
	chain.addLast("threadPool", new ExecutorFilter(threadpool));

	acceptor.setReuseAddress(minaServerConfig.isReuseAddress()); // 允许地址重用

	SocketSessionConfig sc = acceptor.getSessionConfig();
	sc.setReuseAddress(minaServerConfig.isReuseAddress());
	sc.setReceiveBufferSize(minaServerConfig.getMaxReadSize());
	sc.setSendBufferSize(minaServerConfig.getSendBufferSize());
	sc.setTcpNoDelay(minaServerConfig.isTcpNoDelay());
	sc.setSoLinger(minaServerConfig.getSoLinger());
	sc.setIdleTime(IdleStatus.READER_IDLE, minaServerConfig.getReaderIdleTime());
	sc.setIdleTime(IdleStatus.WRITER_IDLE, minaServerConfig.getWriterIdleTime());

	acceptor.setHandler(ioHandler);

	try {
		acceptor.bind(new InetSocketAddress(minaServerConfig.getHttpPort()));
		LOG.warn("已开始监听HTTP端口:{}", minaServerConfig.getHttpPort());
	} catch (IOException e) {
		SysUtil.exit(getClass(), e, "监听HTTP端口:{}已被占用", minaServerConfig.getHttpPort());
	}
}
 
Example #9
Source File: UdpServer.java    From game-server with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void run() {
	synchronized (this) {
		if (!isRunning) {
			DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
			if (factory == null) {
				factory = new DefaultProtocolCodecFactory();
			}
			factory.getDecoder().setMaxReadSize(minaServerConfig.getMaxReadSize());
			factory.getEncoder().setMaxScheduledWriteMessages(minaServerConfig.getMaxScheduledWriteMessages());
			chain.addLast("codec", new ProtocolCodecFilter(factory));
			threadpool = new OrderedThreadPoolExecutor(minaServerConfig.getOrderedThreadPoolExecutorSize());
			chain.addLast("threadPool", new ExecutorFilter(threadpool));
			if(filters != null){
                   filters.forEach((key, filter)->chain.addLast(key, filter));
			}

			DatagramSessionConfig dc = acceptor.getSessionConfig();
			dc.setReuseAddress(minaServerConfig.isReuseAddress());
			dc.setReceiveBufferSize(minaServerConfig.getReceiveBufferSize());
			dc.setSendBufferSize(minaServerConfig.getSendBufferSize());
			dc.setIdleTime(IdleStatus.READER_IDLE, minaServerConfig.getReaderIdleTime());
			dc.setIdleTime(IdleStatus.WRITER_IDLE, minaServerConfig.getWriterIdleTime());
			dc.setBroadcast(true);
			dc.setCloseOnPortUnreachable(true);

			acceptor.setHandler(ioHandler);
			try {
				acceptor.bind(new InetSocketAddress(minaServerConfig.getPort()));
				LOGGER.warn("已开始监听UDP端口:{}", minaServerConfig.getPort());
			} catch (IOException e) {
				LOGGER.warn("监听UDP端口:{}已被占用", minaServerConfig.getPort());
				LOGGER.error("UDP, 服务异常", e);
			}
		}
	}
}
 
Example #10
Source File: LdapServer.java    From MyVirtualDirectory with Apache License 2.0 5 votes vote down vote up
/**
 * reloads the SSL context by replacing the existing SslFilter
 * with a new SslFilter after reloading the keystore.
 * 
 * Note: should be called to reload the keystore after changing the digital certificate.
 */
public void reloadSslContext() throws Exception
{
    if ( !started )
    {
        return;
    }

    LOG.info( "reloading SSL context..." );

    loadKeyStore();

    String sslFilterName = "sslFilter";
    for ( IoFilterChainBuilder chainBuilder : chainBuilders )
    {
        DefaultIoFilterChainBuilder dfcb = ( ( DefaultIoFilterChainBuilder ) chainBuilder );
        if ( dfcb.contains( sslFilterName ) )
        {
            DefaultIoFilterChainBuilder newChain = ( DefaultIoFilterChainBuilder ) LdapsInitializer
                .init( this );
            dfcb.replace( sslFilterName, newChain.get( sslFilterName ) );
            newChain = null;
        }
    }

    StartTlsHandler handler = ( StartTlsHandler ) getExtendedOperationHandler( StartTlsHandler.EXTENSION_OID );
    if ( handler != null )
    {
        handler.setLdapServer( this );
    }

    LOG.info( "reloaded SSL context successfully" );
}
 
Example #11
Source File: AbstractIoService.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public final DefaultIoFilterChainBuilder getFilterChain() {
    if (filterChainBuilder instanceof DefaultIoFilterChainBuilder) {
        return (DefaultIoFilterChainBuilder) filterChainBuilder;
    }

    throw new IllegalStateException("Current filter chain builder is not a DefaultIoFilterChainBuilder.");
}
 
Example #12
Source File: MINAConnectionAcceptor.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized void reconfigure( ConnectionConfiguration configuration )
{
    this.configuration = configuration;

    if ( socketAcceptor == null )
    {
        return; // reconfig will occur when acceptor is started.
    }

    final DefaultIoFilterChainBuilder filterChain = socketAcceptor.getFilterChain();

    if ( filterChain.contains( ConnectionManagerImpl.EXECUTOR_FILTER_NAME ) )
    {
        final ExecutorFilter executorFilter = (ExecutorFilter) filterChain.get( ConnectionManagerImpl.EXECUTOR_FILTER_NAME );
        ( (ThreadPoolExecutor) executorFilter.getExecutor()).setCorePoolSize( ( configuration.getMaxThreadPoolSize() / 4 ) + 1 );
        ( (ThreadPoolExecutor) executorFilter.getExecutor()).setMaximumPoolSize( ( configuration.getMaxThreadPoolSize() ) );
    }

    if ( configuration.getTlsPolicy() == Connection.TLSPolicy.legacyMode )
    {
        // add or replace TLS filter (that's used only for 'direct-TLS')
        try
        {
            final SslFilter sslFilter = encryptionArtifactFactory.createServerModeSslFilter();
            if ( filterChain.contains( ConnectionManagerImpl.TLS_FILTER_NAME ) )
            {
                filterChain.replace( ConnectionManagerImpl.TLS_FILTER_NAME, sslFilter );
            }
            else
            {
                filterChain.addAfter( ConnectionManagerImpl.EXECUTOR_FILTER_NAME, ConnectionManagerImpl.TLS_FILTER_NAME, sslFilter );
            }
        }
        catch ( KeyManagementException | NoSuchAlgorithmException | UnrecoverableKeyException | KeyStoreException e )
        {
            Log.error( "An exception occurred while reloading the TLS configuration.", e );
        }
    }
    else
    {
        // The acceptor is in 'startTLS' mode. Remove TLS filter (that's used only for 'direct-TLS')
        if ( filterChain.contains( ConnectionManagerImpl.TLS_FILTER_NAME ) )
        {
            filterChain.remove( ConnectionManagerImpl.TLS_FILTER_NAME );
        }
    }

    if ( configuration.getMaxBufferSize() > 0 )
    {
        socketAcceptor.getSessionConfig().setMaxReadBufferSize( configuration.getMaxBufferSize() );
        Log.debug( "Throttling read buffer for connections to max={} bytes", configuration.getMaxBufferSize() );
    }
}
 
Example #13
Source File: MINAConnectionAcceptor.java    From Openfire with Apache License 2.0 4 votes vote down vote up
/**
 * Starts this acceptor by binding the socket acceptor. When the acceptor is already started, a warning will be
 * logged and the method invocation is otherwise ignored.
 */
@Override
public synchronized void start()
{
    if ( socketAcceptor != null )
    {
        Log.warn( "Unable to start acceptor (it is already started!)" );
        return;
    }

    try
    {
        // Configure the thread pool that is to be used.
        final int initialSize = ( configuration.getMaxThreadPoolSize() / 4 ) + 1;
        final ExecutorFilter executorFilter = new ExecutorFilter( initialSize, configuration.getMaxThreadPoolSize(), 60, TimeUnit.SECONDS );
        final ThreadPoolExecutor eventExecutor = (ThreadPoolExecutor) executorFilter.getExecutor();
        final ThreadFactory threadFactory = new NamedThreadFactory( name + "-thread-", eventExecutor.getThreadFactory(), true, null );
        eventExecutor.setThreadFactory( threadFactory );

        // Construct a new socket acceptor, and configure it.
        socketAcceptor = buildSocketAcceptor();

        if ( JMXManager.isEnabled() )
        {
            configureJMX( socketAcceptor, name );
        }

        final DefaultIoFilterChainBuilder filterChain = socketAcceptor.getFilterChain();
        filterChain.addFirst( ConnectionManagerImpl.EXECUTOR_FILTER_NAME, executorFilter );

        // Add the XMPP codec filter
        filterChain.addAfter( ConnectionManagerImpl.EXECUTOR_FILTER_NAME, ConnectionManagerImpl.XMPP_CODEC_FILTER_NAME, new ProtocolCodecFilter( new XMPPCodecFactory() ) );

        // Kill sessions whose outgoing queues keep growing and fail to send traffic
        filterChain.addAfter( ConnectionManagerImpl.XMPP_CODEC_FILTER_NAME, ConnectionManagerImpl.CAPACITY_FILTER_NAME, new StalledSessionsFilter() );

        // Ports can be configured to start connections in SSL (as opposed to upgrade a non-encrypted socket to an encrypted one, typically using StartTLS)
        if ( configuration.getTlsPolicy() == Connection.TLSPolicy.legacyMode )
        {
            final SslFilter sslFilter = encryptionArtifactFactory.createServerModeSslFilter();
            filterChain.addAfter( ConnectionManagerImpl.EXECUTOR_FILTER_NAME, ConnectionManagerImpl.TLS_FILTER_NAME, sslFilter );
        }

        // Throttle sessions who send data too fast
        if ( configuration.getMaxBufferSize() > 0 )
        {
            socketAcceptor.getSessionConfig().setMaxReadBufferSize( configuration.getMaxBufferSize() );
            Log.debug( "Throttling read buffer for connections to max={} bytes", configuration.getMaxBufferSize() );
        }

        // Start accepting connections
        socketAcceptor.setHandler( connectionHandler );
        socketAcceptor.bind( new InetSocketAddress( configuration.getBindAddress(), configuration.getPort() ) );
    }
    catch ( Exception e )
    {
        System.err.println( "Error starting " + configuration.getPort() + ": " + e.getMessage() );
        Log.error( "Error starting: " + configuration.getPort(), e );
        // Reset for future use.
        if (socketAcceptor != null) {
            try {
                socketAcceptor.unbind();
            } finally {
                socketAcceptor = null;
            }
        }
    }
}
 
Example #14
Source File: LdapsInitializer.java    From MyVirtualDirectory with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize the LDAPS server.
 *
 * @param ldapServer The LDAP server instance
 * @param transport The TCP transport that contains the SSL configuration
 * @return A IoFilter chain
 * @throws LdapException If we had a pb
 */
public static IoFilterChainBuilder init( LdapServer ldapServer, TcpTransport transport ) throws LdapException
{
    SSLContext sslCtx;

    try
    {
    	sslCtx = ldapServer.getSSLContext();
    	
    	//TODO see if this is correct
    	// Initialize the SSLContext to work with our key managers.
        //sslCtx = SSLContext.getInstance( "TLS" );
        //sslCtx.init( ldapServer.getKeyManagerFactory().getKeyManagers(), new TrustManager[]
        //    { new NoVerificationTrustManager() }, new SecureRandom() );
    	
    }
    catch ( Exception e )
    {
        throw new LdapException( I18n.err( I18n.ERR_683 ), e );
    }

    DefaultIoFilterChainBuilder chain = new DefaultIoFilterChainBuilder();
    SslFilter sslFilter = new SslFilter( sslCtx );

    // The ciphers
    List<String> cipherSuites = transport.getCipherSuite();

    if ( ( cipherSuites != null ) && !cipherSuites.isEmpty() )
    {
        sslFilter.setEnabledCipherSuites( cipherSuites.toArray( new String[cipherSuites.size()] ) );
    }

    // The protocols
    List<String> enabledProtocols = transport.getEnabledProtocols();

    if ( ( enabledProtocols != null ) && !enabledProtocols.isEmpty() )
    {
        sslFilter.setEnabledProtocols( enabledProtocols.toArray( new String[enabledProtocols.size()] ) );
    }
    else
    {
        // Be sure we disable SSLV3
        sslFilter.setEnabledProtocols( new String[]
            { "SSLv2Hello", "TLSv1", "TLSv1.1", "TLSv1.2" } );
    }

    // The remaining SSL parameters
    sslFilter.setNeedClientAuth( transport.isNeedClientAuth() );
    sslFilter.setWantClientAuth( transport.isWantClientAuth() );
    
    chain.addLast( "sslFilter", sslFilter );

    return chain;
}
 
Example #15
Source File: AbstractIoService.java    From jane with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public final void setFilterChainBuilder(IoFilterChainBuilder builder) {
	filterChainBuilder = (builder != null ? builder : new DefaultIoFilterChainBuilder());
}
 
Example #16
Source File: AbstractIoService.java    From jane with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public final DefaultIoFilterChainBuilder getDefaultIoFilterChainBuilder() {
	if (filterChainBuilder instanceof DefaultIoFilterChainBuilder)
		return (DefaultIoFilterChainBuilder)filterChainBuilder;
	throw new IllegalStateException("not DefaultIoFilterChainBuilder");
}
 
Example #17
Source File: AbstractMINAService.java    From sailfish-core with Apache License 2.0 4 votes vote down vote up
protected void initFilterChain(DefaultIoFilterChainBuilder filterChain) throws Exception {
    CodecFactory codecFactory = new CodecFactory(serviceContext, messageFactory, dictionary, getCodecClass(), getCodecSettings());
    filterChain.addLast("codec", new ProtocolCodecFilter(codecFactory));
}
 
Example #18
Source File: TcpServer.java    From game-server with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public void run() {
    synchronized (this) {
        if (!isRunning) {
            isRunning = true;
            DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
            if (factory == null) {
                factory = new DefaultProtocolCodecFactory();
            }

            if (factory instanceof DefaultProtocolCodecFactory) {
                ProtocolCodecFactoryImpl defaultFactory = (ProtocolCodecFactoryImpl) factory;
                defaultFactory.getDecoder().setMaxReadSize(minaServerConfig.getMaxReadSize());
                defaultFactory.getEncoder()
                              .setMaxScheduledWriteMessages(minaServerConfig.getMaxScheduledWriteMessages());
            }

            chain.addLast("codec", new ProtocolCodecFilter(factory));
            threadpool = new OrderedThreadPoolExecutor(minaServerConfig.getOrderedThreadPoolExecutorSize());
            chain.addLast("threadPool", new ExecutorFilter(threadpool));
            if (filters != null) {
                filters.forEach((key, filter) -> {
                    if ("ssl".equalsIgnoreCase(key) || "tls".equalsIgnoreCase(key)) { // ssl过滤器必须添加到首部
                        chain.addFirst(key, filter);
                    } else {
                        chain.addLast(key, filter);
                    }
                });
            }

            acceptor.setReuseAddress(minaServerConfig.isReuseAddress()); // 允许地址重用

            SocketSessionConfig sc = acceptor.getSessionConfig();
            sc.setReuseAddress(minaServerConfig.isReuseAddress());
            sc.setReceiveBufferSize(minaServerConfig.getReceiveBufferSize());
            sc.setSendBufferSize(minaServerConfig.getSendBufferSize());
            sc.setTcpNoDelay(minaServerConfig.isTcpNoDelay());
            sc.setSoLinger(minaServerConfig.getSoLinger());
            sc.setIdleTime(IdleStatus.READER_IDLE, minaServerConfig.getReaderIdleTime());
            sc.setIdleTime(IdleStatus.WRITER_IDLE, minaServerConfig.getWriterIdleTime());

            acceptor.setHandler(ioHandler);

            try {
                acceptor.bind(new InetSocketAddress(minaServerConfig.getPort()));
                log.warn("已开始监听TCP端口:{}", minaServerConfig.getPort());
            } catch (IOException e) {
                log.warn("监听TCP端口:{}已被占用", minaServerConfig.getPort());
                log.error("TCP 服务异常", e);
            }
        }
    }
}
 
Example #19
Source File: WrapperNioSocketAcceptor.java    From sailfish-core with Apache License 2.0 4 votes vote down vote up
public DefaultIoFilterChainBuilder getFilterChain() {
       return nioSocketAcceptor.getFilterChain();
}
 
Example #20
Source File: WrapperNioSocketConnector.java    From sailfish-core with Apache License 2.0 4 votes vote down vote up
public DefaultIoFilterChainBuilder getFilterChain() {
       return nioSocketConnector.getFilterChain();
}
 
Example #21
Source File: IoService.java    From jane with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * A shortcut for <tt>( (DefaultIoFilterChainBuilder) </tt>{@link #getFilterChainBuilder()}<tt> )</tt>.
 * Modifying the returned builder won't affect the existing {@link IoSession}s at all,
 * because {@link IoFilterChainBuilder}s affect only newly created {@link IoSession}s.
 *
 * @return The filter chain in use
 * @throws IllegalStateException if the current {@link IoFilterChainBuilder} is not a {@link DefaultIoFilterChainBuilder}
 */
DefaultIoFilterChainBuilder getDefaultIoFilterChainBuilder();
 
Example #22
Source File: IoService.java    From neoscada with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * A shortcut for <tt>( ( DefaultIoFilterChainBuilder ) </tt>{@link #getFilterChainBuilder()}<tt> )</tt>.
 * Please note that the returned object is not a <b>real</b> {@link IoFilterChain}
 * but a {@link DefaultIoFilterChainBuilder}.  Modifying the returned builder
 * won't affect the existing {@link IoSession}s at all, because
 * {@link IoFilterChainBuilder}s affect only newly created {@link IoSession}s.
 *
 * @throws IllegalStateException if the current {@link IoFilterChainBuilder} is
 *                               not a {@link DefaultIoFilterChainBuilder}
 */
DefaultIoFilterChainBuilder getFilterChain();
 
Example #23
Source File: SlaveHost.java    From neoscada with Eclipse Public License 1.0 votes vote down vote up
public void customizeFilterChain ( DefaultIoFilterChainBuilder filterChain ); 
Example #24
Source File: IServerScript.java    From game-server with MIT License votes vote down vote up
/**
 * mina 添加过滤器
 * @author JiangZhiYong
 * @QQ 359135103
 * 2017年9月4日 上午10:46:33
 * @param chain
 */
default void addFilter(DefaultIoFilterChainBuilder chain){
	
}