You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mitch Claborn <mi...@claborn.net> on 2009/07/07 18:21:35 UTC

Immediately persist sessions to database

I'm experimenting with writing some code to persist a session to the
database, similar to org.apache.catalina.session.PersistentManager and
org.apache.catalina.session.JDBCStore, but to store it immediately after
the end of a user request, when the session goes out of "scope".  Any
pointers on where to start?

I've played a bit with extending or replacing the above classes, but it
looks like the backgroundProcess(), which is the starting point of the
logic that persists sessions is only called every 10 seconds from the
Container.

Is there a way for a Manger to get control when a session goes out of scope?


Mitch


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Immediately persist sessions to database

Posted by Mitch Claborn <mi...@claborn.net>.
That worked great.  Thanks.


Mitch Claborn




Rainer Jung wrote:
> On 07.07.2009 18:21, Mitch Claborn wrote:
>   
>> I'm experimenting with writing some code to persist a session to the
>> database, similar to org.apache.catalina.session.PersistentManager and
>> org.apache.catalina.session.JDBCStore, but to store it immediately after
>> the end of a user request, when the session goes out of "scope".  Any
>> pointers on where to start?
>>
>> I've played a bit with extending or replacing the above classes, but it
>> looks like the backgroundProcess(), which is the starting point of the
>> logic that persists sessions is only called every 10 seconds from the
>> Container.
>>
>> Is there a way for a Manger to get control when a session goes out of scope?
>>     
>
> You could look at the ReplicationValve which is part of the cluster and
> triggers replication at the end of request handling. A valve can
> interfere with request processing very early and very late in the
> request lifecycle and can use internal Tomcat classes (the main
> difference between a valve and a filter).
>
> Regards,
>
> Rainer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
>   

Re: Immediately persist sessions to database

Posted by Rainer Jung <ra...@kippdata.de>.
On 07.07.2009 18:21, Mitch Claborn wrote:
> I'm experimenting with writing some code to persist a session to the
> database, similar to org.apache.catalina.session.PersistentManager and
> org.apache.catalina.session.JDBCStore, but to store it immediately after
> the end of a user request, when the session goes out of "scope".  Any
> pointers on where to start?
> 
> I've played a bit with extending or replacing the above classes, but it
> looks like the backgroundProcess(), which is the starting point of the
> logic that persists sessions is only called every 10 seconds from the
> Container.
> 
> Is there a way for a Manger to get control when a session goes out of scope?

You could look at the ReplicationValve which is part of the cluster and
triggers replication at the end of request handling. A valve can
interfere with request processing very early and very late in the
request lifecycle and can use internal Tomcat classes (the main
difference between a valve and a filter).

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org