Connection pooling

"Trustin Lee (이희승)" trustin at gmail.com
Mon Mar 8 04:54:37 EST 2010


Hi,

What I can find from the first glance is that you are not using
ChannelPipelineFactory to call Bootstrap.setPipelineFactory().  It means
your handler might not work correctly if you create a new bootstrap for
every new connection.  All examples in 3.2 have been updated to use
setPipelineFactory() instead of getPipeline().addLast(...) - please
refer to them to how to fix it.

HTH,
Trustin

chatura02334 wrote:
> Hi Trustin,
> 
>   I tried to reused client channel through some pooling as I before mention.
> Every channel that manage by pool is going through some life cycle stages
> like connect->login->execute->logout.. Each & every stage there were some
> commands triggering to server side and waiting for valid response. But
> something going wrong in command sending after initial login stage
> action(channel write) no more data going to write to above channel even
> other commands where execute and some error (ClosedChannelException )raise
> when it going to close. It seems some pending write request in pipeline.
> 
>  This is in how I create pipeline in client.
> bootstrap.getPipeline().addLast("framer",new
> LengthFieldBasedFrameDecoder(xmlMessageSizeLimit,0,4,6, 0));
> bootstrap.getPipeline().addLast("headerdecoder",new
> ClientDisassameblerDecoder());
> bootstrap.getPipeline().addLast("responseencoder",new
> ClientCommandEncoder());
> ClientRequestHandler requestHandler = new ClientRequestHandler();
> bootstrap.getPipeline().addLast("handler", requestHandler);
> 
> Below code use in last pipeline handler which is a endcoder .
> ClientDisassameblerDecoder.java (OneToOneEncoder) 
> protected Object encode(ChannelHandlerContext ctx, Channel channel,
> 			Object msg) throws Exception {
> 		ProtocolCommand command = (ProtocolCommand) msg;
> 		ProtocolCommand pdu = (ProtocolCommand) command.execute();
> 		String content = (String) pdu.getSource();
> 		ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
> 		buf.writeInt(content.length());
> 		buf.writeShort(pdu.getCommandId());
> 		buf.writeInt(pdu.getSeqNum());
> 		buf.writeBytes(content.getBytes("UTF-8"));
> 		return buf;
> 	}
> Pls let me know something I missing ?
> 
> Thanks
> Chatura.
> 

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100308/9eea68ae/attachment.bin 


More information about the netty-users mailing list