Always add to cache now that we change RemoteSession for sessions with same id
@@ -15,23 +15,13 @@ public class SessionCache<SESSIONTYPE extends Session> {
private final HashMap<Long, SESSIONTYPE> sessions = new HashMap<>();
- public synchronized void putSession(SESSIONTYPE session) {
- sessions.putIfAbsent(session.getSessionId(), session);
- }
+ public synchronized void putSession(SESSIONTYPE session) { sessions.put(session.getSessionId(), session); }
synchronized void removeSession(long id) {
sessions.remove(id);
}
- /**
- * Gets a Session
- *
- * @param id session id
- * @return a session belonging to the id supplied, or null if no session with the id was found
- */
- public synchronized SESSIONTYPE getSession(long id) {
- return sessions.get(id);
- }
+ public synchronized SESSIONTYPE getSession(long id) { return sessions.get(id); }
public synchronized List<SESSIONTYPE> getSessions() {
return new ArrayList<>(sessions.values());
