This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of DevSecOps Adventures: A Game-Changing Approach with Chocolate, LEGO, and Coaching Games and have Dana Pylayeva on-line!
See this thread for details.
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Number of online users

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So how are you handling the counting of how many guests and registered users (with their names) are online in jforum?

I started to do this with a servletcontext attribute, but according to the javadocs, this isn't thread safe, and even if i syncronized it, the javadocs say that on distributed systems, there is one servlet context per java virtual machine, so it basically says to use a database instead.

Even if i dismissed distributed computers, the HttpSessionListener listens as soon as a session gets created/deleted so i can't retrieve attributes in there since they haven't been assigned yet.

I haven't found a proper interface yet, will keep looking
[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess the subscription of new messages in forums/topics gets handled similarly
[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you really need to made your application running in cluster? if not, forget the docs about it.

Anyway, I guess all modern servlet containers will replicate the contents of ServletContext across the nodes, so it won't be a problem. In JForum I have pluggable cache engines, so, when I need clustering, I use jboss-cache, and local static collection classes in other cases.

To count users, you can implement a SessionListener. In JForum, the class is net.jforum.ForumSessionListener.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Weird, your sessionCreated() is empty :!: :!:

Am i looking at the right place?

* @version $Id: ForumSessionListener.java,v 1.14 2005/02/28 12:18:28 rafaelsteil

[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it is empty. Take a look in the class SessionFacade and in the method checkCookies(), of JForum.java. Is there which I add users to my counter.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
If you look closely at this tiny ad, you will see five bicycles and a naked woman:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic