public String createSession(int userId) { String sessionKey = generateSessionId(); synchronized (activeSessions) { activeSessions.put(sessionKey, new Session(userId, sessionKey, timeProvider.now())); } System.out.println("Created session " + sessionKey + " for user " + userId); return sessionKey; }
private boolean hasExpired(Session session) { return timeProvider.now() >= session.getCreateTime() + Settings.SESSION_EXPIRATION_TIME; }