Hi all,
So I was not able to call cluster valve from the application, but I believe a 
http call to localhost with the same session id can do a trick(yeah, not an 
elegant solution :) ).

However, it would be fine is somebody can clarify my another questions about 
tomcatssessions:

1) When using clustering with DeltaManager tomcat fires 
onSessionCreated,onSessionDestroyed on every node and when node joins the 
cluster(for every session). However, when single tomcat is configured with 
default session persistence then onSessionCreated event is fired only when this 
session is accessed after restart(all session attributes are restored 
correctly). Is there any way to force to restore all sessions after restart? 
One solution is to put sessions info to database, but :
a) it will not work when 'clustering with DeltaManager' will be used later 
(database is not required in such case)
b) there is no access to HttpSession object and it is not possible to 
invalidate user sessions
2) What will happen with HttpSession reference which is hold in application 
memory (ConcurrentMap<String, HttpSession>) when tomcat decides to serialize it 
to FS without stopping the tomcat (for example running out of memory). Will 
call to HttpSession.getAttribute fail or tomcat will deserialize the session 
behind the scenes?

Thanks!

-----Original Message-----
From: Ronald Klop (Mailing List) [mailto:ronald-mailingl...@base.nl] 
Sent: Tuesday, October 25, 2011 1:04 PM
To: Tomcat Users List
Subject: RE: Tomcat clustering session attribute is changed without request

Hi,

 Replication of the attributes is done by the cluster valve.
 http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-valve.html

 If you manage to call that code from your own application, than you can do 
what you want. But that is not default functionality of Tomcat. You have to 
make it yourself.

 Ronald.

Op dinsdag, 25 oktober 2011 09:44 schreef "Hodchenkov, Paul" 
<paul.hodchen...@oxagile.com>:
> 
>   
>  Hi All,
>  I have used http://code.google.com/p/psi-probe/ to debug session replication.
>  So HttpSession attribute is NOT replicated when it is changed without http 
> request. It's value is changed only on the local tomcat.
>  However, when attribute is changed with http request - everything works fine.
>  So, is there any way to force the replication of HttpSession?
>  -----Original Message-----
>  From: Pid [mailto:p...@pidster.com]
>  Sent: Monday, October 24, 2011 4:08 PM
>  To: Tomcat Users List
>  Subject: Re: Tomcat clustering session attribute is changed without request
>  
>  On 24/10/2011 14:05, Hodchenkov, Paul wrote:
>  > Hi,
>  > Thanks for the reply!
>  > -> What does 'stores session map in memory' actually mean?
>  > It's ConcurrentMap<String, HttpSession> map which is filled by 
> HttpListener. I can access session attributes of any user using this approach.
>  > Does changes to attributes in HttpSession cause a replication in this case?
>  
>  Don't know, probably.
>  
>  > What is the benefit of using JMX connection to access the session instead 
> of HttpListener in this case?
>  
>  It means you don't have to jump through hoops to access something that is 
> already accessible elsewhere.
>  
>  
>  p
>  
>  > -----Original Message-----
>  > From: Pid [mailto:p...@pidster.com]
>  > Sent: Monday, October 24, 2011 3:59 PM
>  > To: Tomcat Users List
>  > Subject: Re: Tomcat clustering session attribute is changed without
>  > request
>  >
>  > On 24/10/2011 11:55, Hodchenkov, Paul wrote:
>  >> Hi all,
>  >> I have configured tomcat 7 cluster by using [1] with DeltaManager and it 
> works fine.
>  >> However I have the following 2 questions:
>  >>
>  >> 1)      My application stores session map in memory(admin can force 
> logout of any user and change some session attribute). Will this session 
> attribute be replicated if it is changed without tomcat http request (changed 
> by backend task for example)?
>  >
>  > What does 'stores session map in memory' actually mean?
>  >
>  > Instead of copying session objects around the place, why not just use the 
> JMX API and the operations on the Manager MBean?
>  >
>  >  Catalina:type=Manager,context=/myapp,host=localhost
>  >
>  >
>  > p
>  >
>  >> 2)      It's seems that expireSessionsOnShutdown=false in DeltaManager 
> can solve the problem with 
> http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html?
>  >> [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html
>  >>
>  >> Best Regards,
>  >> Paul Hodchenkov
>  >> Senior Java developer, Oxagile
>  >> Skype: paul.hodchenkov
>  >> Email: mailto:paul.hodchen...@oxagile.com
>  >>
>  >>
>  >
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>  > For additional commands, e-mail: users-h...@tomcat.apache.org
>  >
>  
>  
>  
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>  For additional commands, e-mail: users-h...@tomcat.apache.org
>   
>  
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to