directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes McKean <>
Subject Re: Serverside NIO: Not ready for Prime Time
Date Wed, 26 Nov 2003 14:48:32 GMT
Well, what really aggrevates me about all of this is that the implementation I 
am using is relatively simple.  One thread handles the catching of the 
events, and a separate thread handles the processing.  It is all realatively 
clean, and straight forward.  It works like a champ under Linux, and works 
about 70% under Windows.

What I would like to see happen is somebody at Sun address this issue.  Does 
anyone have any experience with this?

Your suggestion for reading the byte buffer in the same thread is less elegant 
than the current solution and could cause issues ( I'm thinking about them as 
I write this :-)  In our case, we are passing the bytes from the 
SocketChannel off to the Decoder for processing.  What happens if an entire 
ASN.1 packet does not come over in the first read event?  This is what will 
have to happen:

1.  The read event comes in.
2.  The *selector* thread reads 2/3rds of the ASN.1 packet ( it has no way of 
knowing when the complete packet has arrived)
3.  It passes the buffer off to the decoder.
4.  The decoder reads  the buffer, and then blocks cause it only has 2/3rds of 
the packet.
5.  The second READ event comes in with the rest of the packet.
6.  The selector thread reads the bytes and appends them to the end of the 
first read.
7.  The decoder thread unblocks and continues reading bytes to the end of the 
ASN.1 packet.

That's gross... but I've got some bandwith this week, so I'm willing to give 
it a try to see if it works.  I'll report back by Friday.


View raw message