directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr <g...@4quarters.com>
Subject Re: Serverside NIO: Not ready for Prime Time
Date Wed, 26 Nov 2003 01:37:08 GMT

On Nov 25, 2003, at 8:25 PM, Peter Donald wrote:

> On Wed, 26 Nov 2003 03:13 am, Wes McKean wrote:
>> The CancelledKeyException seems to be happing because I am removing 
>> the
>> SelectionKey from the iterator.  The other error seems to occur when 
>> I have
>> multiple reads and writes going on with different SocketChannels.  
>> Here is
>> the exception:
>
> I think some of problems will be that you are processing the channels 
> in
> different threads from the select. I can not see a good reason for 
> this.
> Would it not be better to do the reads in the same thread as the 
> selector,
> buffer the data and then send an event that is processed in another 
> thread.

Ye gads.  Why can't you multithread the reads?  What possible reason 
could one come up with that the reads have to happen on the same thread 
as the select?

>
> See attached files for the sort of thing I mean. Associated with each
> connection object I have a TcpTransport object. The selector threads 
> does all
> the nbio and then sends event to "parsing" stage. This seems to work 
> like a
> charm.

Don't that serialize the I/O?

>
> Anyways you may want to check out the spice/sandbox/sca project at
> cvs.codehaus.org:/scm/cvs as it contains code that simplifies working 
> with
> selectors etc.
>
> -- 
> Cheers,
>
> Peter Donald
> I think the next best thing to solving a
> problem is finding some humor in it.
>                 - Frank A. Clark
> <TcpTransport.java>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


Mime
View raw message