Hi, Mark!
On Dec 7, 2007 12:12 PM, Mark Hindess <[EMAIL PROTECTED]> wrote:
> > It looks like the code in NIO selector could do with a good review,
> > and at minimum a few comments if not a partial redesign to tidy up the
> > data structures and which locks are required for which, etc.
>
> I agree. Though it is tempting to revert the HARMONY-4869 optimizations
> (see JIRA comment for the two svn diff commands to do this) since that
> does seem marginally more stable to me.
I wonder if fixing the current legacy selector will be easier - that's
because HARMONY-4869 already has some tidying in data structures. I
suspect there are synchronization problems while modifying the key
already registered on the selector. Can you try wrap the modKey() [1]
with synchronization as follows:
void modKey(SelectionKey sk) {
+ synchronized (this) {
+ synchronized (keysSet) {
// TODO: update indexes rather than recreate the key
delKey(sk);
addKey(sk);
+ }
+ }
}
...and see the difference?
Thanks,
Aleksey.