Monday, May 20, 2002 04:45 AM
Pass some kind of user id to your RMI server during your RMI calls and store it in a hash table as the key together with current time as the value. If the user disconnects, and provided you are able to detect such an event, remove entry for that user from the hash table. You need to make the hash table self-cleaning by having a separate thread that times out and removes stale connections.
Total number of active users are now the number of entries in the hash table.