users@grizzly.java.net

LinuxSpinningWorkaround & managing connections

From: Alexei Dets <adets_at_idsk.com>
Date: Wed, 23 Sep 2009 13:23:05 -0400

Hi!

Can anybody please give me some advice about the ways of managing/tracking
connections (application specific state attached to connection) in Grizzly
framework in light of introduction of LinuxSpinningWorkaround?

What I mean is that I know only 3 ways of doing this and none of them works:
1. Most simple and common: attach some context to SelectionKey. Doesn't work
because of ParserProtocolFilter - it removes attachment.
2. Create some map (list, set etc.) that holds information about the
SelectionKey and its associated context. Doesn't work anymore after
introduction of LinuxSpinningWorkaround - SelectionKey can be invalidated
at any time and so information in the map (list, set etc.) will be stale.
2. Create some map (list, set) etc. that holds information about the
SelectableChannel and its associated context. Doesn't work anymore after
introduction of LinuxSpinningWorkaround - in general it is not possible to
get a SelectionKey for the SelectableChannel (the key you'll get can be
invalidated right away by LinuxSpinningWorkaround in another thread before
you'll be able to do anything with it).

I'm lost... :-(

        Alexei