/** * Create the connector * * @throws LdapException If the connector can't be created */ private void createConnector() throws LdapException { // Use only one thread inside the connector connector = new NioSocketConnector( 1 ); if ( connectionConfig != null ) { ( ( SocketSessionConfig ) connector.getSessionConfig() ).setAll( connectionConfig ); } else { ( ( SocketSessionConfig ) connector.getSessionConfig() ).setReuseAddress( true ); } // Add the codec to the chain connector.getFilterChain().addLast( "ldapCodec", ldapProtocolFilter ); // If we use SSL, we have to add the SslFilter to the chain if ( config.isUseSsl() ) { addSslFilter(); } // Inject the protocolHandler connector.setHandler( this ); }
/** * Create the connector * * @throws LdapException If the connector can't be created */ private void createConnector() throws LdapException { // Use only one thread inside the connector connector = new NioSocketConnector( 1 ); if ( connectionConfig != null ) { ( ( SocketSessionConfig ) connector.getSessionConfig() ).setAll( connectionConfig ); } else { ( ( SocketSessionConfig ) connector.getSessionConfig() ).setReuseAddress( true ); } // Add the codec to the chain connector.getFilterChain().addLast( "ldapCodec", ldapProtocolFilter ); // If we use SSL, we have to add the SslFilter to the chain if ( config.isUseSsl() ) { addSslFilter(); } // Inject the protocolHandler connector.setHandler( this ); }
/** * Create the connector * * @throws LdapException If the connector can't be created */ private void createConnector() throws LdapException { // Use only one thread inside the connector connector = new NioSocketConnector( 1 ); if ( connectionConfig != null ) { ( ( SocketSessionConfig ) connector.getSessionConfig() ).setAll( connectionConfig ); } else { ( ( SocketSessionConfig ) connector.getSessionConfig() ).setReuseAddress( true ); } // Add the codec to the chain connector.getFilterChain().addLast( "ldapCodec", ldapProtocolFilter ); // If we use SSL, we have to add the SslFilter to the chain if ( config.isUseSsl() ) { addSslFilter(); } // Inject the protocolHandler connector.setHandler( this ); }
CommCenterUsers.isConnector = false; CommCenterUsers.minaConnector = new NioSocketConnector(); CommCenterUsers.minaConnector.getSessionConfig().setReadBufferSize(131072); CommCenterUsers.minaConnector.setHandler(new CommCenterClientHandler()); try {
/** * 初始化 * * @author 唐延波 * @date 2015-6-24 */ private void init() { // 设置连接参数 connector = new NioSocketConnector(); connector.setConnectTimeoutMillis(connectTimeoutMillis); connector.getFilterChain().addLast("logger", new LoggingFilter()); //设置读缓冲,传输的内容必须小于此缓冲 connector.getSessionConfig().setReadBufferSize(readBufferSize); if(protocolCodecFactory != null){ connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(protocolCodecFactory)); } ShortClientHandler clientHandler = new ShortClientHandler(); connector.setHandler(clientHandler); }
/** * 初始化 * * @author 唐延波 * @date 2015-6-24 */ private void init() { // 设置连接参数 connector = new NioSocketConnector(); connector.setConnectTimeoutMillis(connectTimeoutMillis); connector.getFilterChain().addLast("logger", new LoggingFilter()); //设置读缓冲,传输的内容必须小于此缓冲 connector.getSessionConfig().setReadBufferSize(readBufferSize); if(protocolCodecFactory != null){ connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(protocolCodecFactory)); } LongClientHandler clientHandler = new LongClientHandler(); connector.setHandler(clientHandler); initConnection(poolSize); }
/** * 初始化 * * @author 唐延波 * @date 2015-6-24 */ private void init() { // 设置连接参数 connector = new NioSocketConnector(); connector.setConnectTimeoutMillis(connectTimeoutMillis); connector.getFilterChain().addLast("logger", new LoggingFilter()); //设置读缓冲,传输的内容必须小于此缓冲 connector.getSessionConfig().setReadBufferSize(readBufferSize); if(protocolCodecFactory != null){ connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(protocolCodecFactory)); } LongAsynClientHandler clientHandler = new LongAsynClientHandler(); connector.setHandler(clientHandler); initConnection(poolSize); }
connector.getSessionConfig().setUseReadOperation(true);