10.4. User Sessions

In addition to the account entry (which stores persistent information for a user), we also need to store data about each user that is present only as long as the user is online. When a user logs in, the messenger creates and writes a SessionEntry object into the space, which serves two purposes. First, its existence in the space means that the user can be considered online. It also provides an object in which per-session information, such as the date and time the user signed on, can be stored. Here is the definition of the session entry:

 public class SessionEntry implements Entry { public String username; public Long loginTime; public SessionEntry() { } public SessionEntry(String username) { this.username = username; } public ...

Get JavaSpaces™ Principles, Patterns, and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.