3 Replies Latest reply on Mar 20, 2009 5:32 AM by ameo

    Get online users

    ameo Novice


      I want to get the current online users that logged in portal. The reason is that I want to verify during the login if a user is already logged, and if so, to give him an appropriate answer.

      I have see the sample portlet that uses the UsersActivityStatsService.

      Cause I use facelets and jsf, I tried to get the UsersActivityStatsService with the following method:

       private UsersActivityStatsService getStatsService() {
       UsersActivityStatsService activityService = null;
       try {
       MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
       activityService = (UsersActivityStatsService) MBeanProxy.get(UsersActivityStatsService.class, new ObjectName(
       "portal:service=Module,type=UsersActivityStatsService"), mbeanServer);
       } catch (MBeanProxyCreationException e) {
       logger.error("could not obtain a proxy for User Activity Statistics Service", e);
       } catch (MalformedObjectNameException e2) {
       logger.error("object name to obtain User Activity Statistics Service is wrong", e2);
       return activityService;

      So I get the service, but if I call the method getActiveUsersNames I get no results.

       UsersActivityStatsService uass = getStatsService();
       Set users = uass.getActiveUsersNames(18000000);

      Could you tell me, how to use this service correctly ?