io.baltoro.client.SessionManager Maven / Gradle / Ivy
package io.baltoro.client;
import java.util.HashMap;
import java.util.Map;
class SessionManager
{
private static Map sessionMap = new HashMap(1000);
/*
static UserSession createSession(String sessionId)
{
UserSession session = new UserSession(sessionId);
sessionMap.put(sessionId, session);
return session;
}
*/
static UserSession getSession(String sessionId)
{
UserSession session = sessionMap.get(sessionId);
if(session == null)
{
session = new UserSession(sessionId);
session.setCreatedOn(System.currentTimeMillis());
sessionMap.put(sessionId, session);
}
return session;
}
static void removeSession(String sessionId)
{
sessionMap.remove(sessionId);
}
}