Hello, can you give the code for the rest of the application because I can't see where all those threads are created (I see only 3 connections in your sample).
Regards Jeff On Thu, May 8, 2014 at 8:59 AM, pongjy123 <[email protected]> wrote: > *hello,all* > > * I have a problem,I have a java process(mina tcp client), need to connect > 1000+ tcp server,my code is :* > connector = new NioSocketConnector(); > connector.getFilterChain().addLast("clientCodec", new > ProtocolCodecFilter(new SplCodecFactory(true, type))); > connector.getSessionConfig().setReadBufferSize(MAX_READ_BUFF_SIZE); > connector.getSessionConfig().setUseReadOperation(true); > connector.setHandler(new SplClientIoHandler(this.receiver, > connectorManager)); > int count = 3; > while(--count >= 0){ > if(count < 2){ > logger.warn("retry connect count:"+count+",addr:"+addr); > } > ConnectFuture connFuture = connector.connect(addr); > connFuture.awaitUninterruptibly(CONNECT_TIMEOUT); > session = connFuture.getSession(); > if(session == null){ > if(count == 0){ > throw new Exception("session is null!" + addr); > } > }else{ > break; > } > } > connectState = ConnectState.CONNECTED; > > *The problem is mina created 1000+thread, So My Processor is so slow, * > *Are there other ways to solve it? * > *If I can just create a thread, with multiple objects to solve the > problem? but i don't know how to do it.* > *Thanks.* > > > 来自网易手机号码邮箱了解更多 <http://shouji.163.com> > -- Jeff MAURY "Legacy code" often differs from its suggested alternative by actually working and scaling. - Bjarne Stroustrup http://www.jeffmaury.com http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury
