Exemple #1
0
 public static synchronized int getUsers() {
   long max_think_time = Configure.getInstance().max_think_time;
   int v = 0;
   long now = System.currentTimeMillis();
   try {
     Enumeration<LongLongLinkedMap.ENTRY> en = users.entries();
     while (en.hasMoreElements()) {
       LongLongLinkedMap.ENTRY e = en.nextElement();
       if (now - e.getValue() > max_think_time) {
         users.remove(e.getKey());
       } else {
         v++;
       }
     }
   } catch (Throwable t) {
     Logger.println("A114", "METER-USERS" + t.toString());
   }
   return v;
 }
Exemple #2
0
 public static void add(long userid) {
   if (userid == 0) firstVisitors.add(1);
   else {
     users.putLast(userid, System.currentTimeMillis());
   }
 }