I've been lurking and searching through the archives searching for an
answer to the issue which was eventually reported as bug #739   I've
found some excellent descriptions of the problem but have been unable to
discover a solution in the archives.  I was hoping that someone can
point me towards a workaround.

Essentially we've written an app server that runs process on different
threads.  These threads all have access to an object which I'll just
call an Mcache object.   Part of the MCache is a hash table so when we
pass the Mcache a session ID it returns that particular session.  As is
standard procedure when dealing with servlets we are saving data that
must be available for the life of the session in the session object
(which is now actually an HttpSessionFacade object).

The problem of course is that I need to call setAttribute and
getAttribute on this session.  And when I do this I have to expect that
the session that the Mcache object refers to by a particular sessionID
is the same object at all times.  However, it seems that any particular
HttpSessionFacade may wrap any particular HttpSession, or even a null if
that facade has been recycled.  Obviously, when we create a session or
get a session or do any of the things which are standard operating
procedure with sessions we would not expect a particular instance of
that session to suddenly change, or even suddenly become null.  This is
not standard behavior of a java.servlet.http.HttpSession and I would not
expect the facade to do so either.

So there must be some workaround.  Because if all my sessions are being
wrapped with HttpSessionFacade against my will, and those facades will
change or nullify themselves against my will then we're basically saying
"If you use Tomcat you can't use a session object because we can no
longer guarantee that your session objects will even exist when you need
them".

This is obviously not what the Tomcat team intended.  So there must be a
way for me to get my session back based on a session ID that I have
saved in my Mcache.  What would be the correct procedure for getting the
HttpSessionFacade that refers to an instance of a
java.servlet.http.HttpSession  that has a particular sessionID ?

I thank you in advance for you assistance.

Greg

Reply via email to