users@grizzly.java.net

Should I use Context to store the clients references ?

From: Survivant 00 <survivant00_at_gmail.com>
Date: Fri, 11 Jul 2008 16:05:35 -0400

I have a chain of 2 filters.

#1 - parsing the request
#2 - processing the request

and loop until the client quit.

I want to kept the info about the connection like :
context.getSelectionKey(), context.getSelectorHandler() in a Object like :


ClientTracker(SelectionKey key, SelectorHandler selectorHandler)

and I'll send data back to the client using the key and the
selectorhandler.

but I don't know where to create that class (ClientTracker) and where to put
it to use it later.

if I create the ClientTracker into the 2 filters.. a new reference will be
created each time the client send a request.. it's not what I want.

I tought of putting the ClientTracker in the context and check if the class
exist in the context.. but like the context could be invalidate, I could
lose the info..

Normally, I would have created the ClientTracker equivalent class, after the
socketserver.accept();