Issue #6752 - Extensible DefaultSessionCache map implementation

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2021-09-09 07:42:55 -05:00
parent 7301efdc80
commit 8788aaef5a
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 12 additions and 2 deletions

View File

@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
/**
* DefaultSessionCache
*
* A session store that keeps its sessions in memory in a concurrent map
* A session store that keeps its sessions in memory within a concurrent map
*/
@ManagedObject
public class DefaultSessionCache extends AbstractSessionCache
@ -38,7 +38,7 @@ public class DefaultSessionCache extends AbstractSessionCache
/**
* The cache of sessions in a concurrent map
*/
protected ConcurrentMap<String, Session> _sessions = new ConcurrentHashMap<>();
private final ConcurrentMap<String, Session> _sessions;
private final CounterStatistic _stats = new CounterStatistic();
@ -46,8 +46,18 @@ public class DefaultSessionCache extends AbstractSessionCache
* @param manager The SessionHandler related to this SessionCache
*/
public DefaultSessionCache(SessionHandler manager)
{
this(manager, new ConcurrentHashMap<>());
}
/**
* @param manager The SessionHandler related to this SessionCache
* @param sessionMap The session map implementation to use
*/
public DefaultSessionCache(SessionHandler manager, ConcurrentMap<String, Session> sessionMap)
{
super(manager);
this._sessions = sessionMap;
}
/**