• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Monitor all sessions in server - my solution - your opinion

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
My task is to monitor all open sessions in a specific time.
My solutions includes Singelton , the Observer design pattern and HttpSessionBindingListener interface.

As the Subject ,in the Observer design pattern, I will have an object named Controller (singelton) that will store all opened sessions.

As observer I will have an object that will wrap a session which will have a reference to the Controller. (initialize in their constructor).

Each observer will implement the HttpSessionBindingListener this way in valueBound method I will add it to the observer and in valueUnbound i will remove it.

BTW if someone wants to extends the observer class for his personal use all it have to do is to extend it and call super() in his constructor...

WHAT DO YOU THINK?
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when you say you want to monitor sessions what do you mean? In this case it looks like you are simply putting your session objects in a data structure. what info do you want from them? How many session objects are there currently? If so, has some sample code that can do this. You will be able to tell how many sessions there are currently and how many there were at the max among other things. The code follows:

http://jamonapi.sourceforge.net/httpsession_sample.html
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic