All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.baltoro.client.SessionManager Maven / Gradle / Ivy

There is a newer version: 4.0.12
Show newest version
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);
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy