Randomly getting unexpected bytes in the ChannelBuffer from test client with valid data
ljohnston
johnstlr at yahoo.co.uk
Tue Jan 18 03:58:14 EST 2011
Hi Todd
tnine wrote:
>
> Just an update. This issue seems to be related to using the following
> with the client
>
> ExecutorService workers = Executors.newFixedThreadPool(5);
>
> With a max thread pool defined, the data I receive is not always what I
> send via the data channel. If I use this
>
> ExecutorService workers = Executors.newCachedThreadPool();
>
> I never have this issue.
>
If you're using a fixed sized thread pool you need to tell netty how many
threads are in the pool. This goes for both NioServerSocketChannelFactory
and NioClientSocketChannelFactory. Both have an alternative constructor
which takes a third argument of workerCount.
If you don't do this Netty assumes there are (2 * number of available
processors) threads available. This might be why you're seeing threads
getting in each other's way.
See if that solves your problem.
Cheers
Lee
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Randomly-getting-unexpected-bytes-in-the-ChannelBuffer-from-test-client-with-valid-data-tp5933385p5934892.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list