• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Number of online users  RSS feed

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!