[jboss-user] [JBoss Portal] - Get online users

ameo do-not-reply at jboss.com
Thu Mar 12 07:06:49 EDT 2009


Hello,

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 ?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4217384#4217384

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4217384



More information about the jboss-user mailing list