• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

httpsessionlistener in distributed application

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i have a simple servlet that counts the people on the site: a listener which implements httpsessionlistener; there is a counter in the application context, it is updated in a synchronized block.

Everything is OK when the application runs on one web container. But how can i have a counter if the application runs on two web containers?

i will appreciate any ideas.

thanks in advance.
best regards.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would have to tell us a little bit about how you are deploying your app.
Are you using session replication, IP Load balancing, a common database?
 
osman cinar eren
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

actually i have implemented a portlet which runs on Websphere Apllication server. There will be two WASs and the requests will be given to them by IBM Edge Servers. I dont know the details about the edge servers, but i can learn if you wish.
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more we have a tag distributable in web.xml? Will this help?
 
osman cinar eren
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i dont think so as there will be 2 application contexts and i must have the sum of the values in them.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not that familiar with WAS.
I believe, if you're using session replication, that the session events would be fired on all machines in the cluster (I'm not certain of this though).

If this is not the case, you could, if you are using a shared database, write your session counting data to it from both apps. You might also want to look into Java Messaging Service (JMS) and/or Java's Remote Method Invocation (RMI).

My own solution to this was to build a split-screen webpage that shows both servers, each in their own frame. Since I'm the only one who uses it, this cheap, 5 minute hack is more than sufficient.
Your needs may vary.
 
Replace the word "snake" with "danger noodle" in all tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic