Author: taylor
Date: Mon Jan 15 11:57:32 2007
New Revision: 496455

URL: http://svn.apache.org/viewvc?view=rev&rev=496455
Log:
https://issues.apache.org/jira/browse/JS2-637

PortalStatistics.getNumberOfLoggedInUsers() is sometimes inaccurate and even 
returns negative values.
Just recognized this as we are showing the current users count in the footer 
decorator.

contribution from Thorsten Berger

Modified:
    
portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java

Modified: 
portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java?view=diff&rev=496455&r1=496454&r2=496455
==============================================================================
--- 
portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
 (original)
+++ 
portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
 Mon Jan 15 11:57:32 2007
@@ -362,8 +362,6 @@
 
             if (!"guest".equals(userName))
             {
-                currentUserCount = currentUserCount - 1;
-
                 synchronized (currentUsers)
                 {
                     UserStats userStats = (UserStats) currentUsers
@@ -374,6 +372,10 @@
                         userStats.setNumberOfSession(0);
                         userStats.setUsername(userName);
                         currentUsers.put(userName, userStats);
+                    }else
+                    {
+                       // only decrement if user has been logged in
+                       currentUserCount = currentUserCount - 1;
                     }
                     userStats.setNumberOfSession(userStats
                             .getNumberOfSessions() - 1);



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

Reply via email to