-
1. Re: Clustering is working perfectly, but a small question
rhusar Mar 31, 2014 6:51 PM (in response to krahn007)I'm interested in the following: Once session replication occurs, is there a way to trigger code to be run in the application server to which data is replicated? For example, a user logs into Server 1, does something which triggers a replication to Server 2. Is it possible to cause some code to run once the replication occurs on Server 2?
I assume you mean when the actual failover happens and not on every replication?
Sounds like the best bet for you is the HttpSessionActivationListener, see http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpSessionActivationListener.html#sessionDidActivate(javax.servlet.http.HttpSessionEvent)
-
2. Re: Clustering is working perfectly, but a small question
pferraro Apr 1, 2014 11:42 AM (in response to rhusar)1 of 1 people found this helpfulI'm not certain that this actually works as it should in AS 7.2.0, although it definitely does in WildFly 8.0.0.
N.B. You should never attempt to modify the session in a session activation listener. These changes would need to replicate, which would trigger the session activation listener again, ad infinitum. To guard against this in WildFly, attempts to modify the session from a session activation listener will throw an IllegalStateException.
-
3. Re: Clustering is working perfectly, but a small question
krahn007 Apr 1, 2014 12:01 PM (in response to pferraro)I think Paul is right. I don't see this working in my AS 7.2.0 deployment. I can't seem to get the implementation methods of this class to ever run. Unfortunately, WildFly 8.0.0 is not an option at the moment.
Thanks for the note on the modification. I only need these sessions on activation to populate some proprietary lists with the ID strings, which are immutable anyways.
-
4. Re: Clustering is working perfectly, but a small question
rhusar Apr 2, 2014 3:27 AM (in response to krahn007)Ah, different versions, different caveats