Skip to content

Commit

Permalink
Issue #6752 - Extensible DefaultSessionCache map implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
  • Loading branch information
joakime committed Sep 9, 2021
1 parent 30b42d2 commit bc3fa13
Showing 1 changed file with 13 additions and 2 deletions.
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.jetty.server.session;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Function;
import javax.servlet.http.HttpServletRequest;

Expand All @@ -27,7 +28,7 @@
/**
* DefaultSessionCache
*
* A session store that keeps its sessions in memory in a hashmap
* A session store that keeps its sessions in memory within a concurrent map
*/
@ManagedObject
public class DefaultSessionCache extends AbstractSessionCache
Expand All @@ -37,16 +38,26 @@ public class DefaultSessionCache extends AbstractSessionCache
/**
* The cache of sessions in a hashmap
*/
protected ConcurrentHashMap<String, Session> _sessions = new ConcurrentHashMap<>();
private final ConcurrentMap<String, Session> _sessions;

private final CounterStatistic _stats = new CounterStatistic();

/**
* @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;
}

/**
Expand Down

0 comments on commit bc3fa13

Please sign in to comment.