(nb: I'm struggling to check the bug parade on this, but it's not searchable for the term "attach" so it's frickin hard; c.f. http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=cluebies;action=display;num=1088616088
I'm fairly confident there's a mean, nasty, evil bug in 1.4.2 whereby SelectionKey's arbitrarily kill their attachments, silently.
The situation I'm in, I just ran a full text search for "attach(" against all source code in the server, and verified that I have a breakpoint (or logging point) on every single line of code where it's called, and yet I'm seeing attachments flip from a LinkedList to null without me touching them.
I think the problem might be that when you reset the interest set for a SelectionKey, sometime later (not immediately) it decides to wipe out it's attachment. I'm trying to construct a case that proves it, but it is definitely time sensitive, which is not surprising since it's probably triggered by the Selector doing something internally. But I might not be able to make a conclusive test case because of the timing-sensitivity