A class like this put into the session of every user by a subclassed
SessionValidator
should do the trick...

public class SessionCounter implements HttpSessionBindingListener
{
        private static int count = 0;
        private SessionCounter instance = null;

        public static getInstance()
        {
                if (instance!=null)
                {
                        instance = new SessionCounter();
                }
                return instance;
        }
        
        public void valueBound(HttpSessionBindingEvent event)
        {
                synchronized (instance)
                {
                        count++;
                }
        }

        public void valueUnbound(HttpSessionBindingEvent event)
        {
                synchronized (instance)
                {
                        count--;
                }
        }

        public static int getCount()
        {
                return count;
        }
}

Basically you end up counting the number of active sessions in the portal,
which
allows you to count both logged in and anonymous users. 

--
Rapha�l Luta - [EMAIL PROTECTED]
Jakarta Jetspeed - Enterprise Portal in Java
http://jakarta.apache.org/jetspeed/

> -----Message d'origine-----
> De : Matthew Schmidt [mailto:[EMAIL PROTECTED]]
> Envoy� : mardi 17 septembre 2002 20:17
> � : Jetspeed Users List
> Objet : Getting all logged in users
> 
> 
> Hi All,
>     Sorry to send all these questions, but I find Jetspeed 
> very interesting and I'm considering it for a major project 
> at Javalobby.  I noticed that the Turbine RunData interface 
> allows you to get the current logged in user.  Is there a way 
> to have Turbine retrieve all the users that are logged in?  
> This would allow me to do something like what PhpNuke has 
> that tells the person looking at the page how many people are 
> viewing the site at the moment.  Has anyone had any 
> experience with this?
> 
>     Thanks,
>     Matthew Schmidt 
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to