Skip to content

Commit

Permalink
Merge pull request #6758 from eclipse/jetty-10.0.x-extensible-default…
Browse files Browse the repository at this point in the history
…-session-cache

Issue #6752 - Extensible DefaultSessionCache map implementation
  • Loading branch information
joakime committed Sep 15, 2021
2 parents 355f446 + a223815 commit 51f6a58
Showing 1 changed file with 13 additions and 2 deletions.
Expand Up @@ -13,6 +13,7 @@

package org.eclipse.jetty.server.session;

import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Function;
Expand All @@ -28,7 +29,7 @@
/**
* 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
Expand All @@ -38,16 +39,26 @@ 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();

/**
* @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 sessions The session map implementation to use
*/
public DefaultSessionCache(SessionHandler manager, ConcurrentMap<String, Session> sessions)
{
super(manager);
_sessions = Objects.requireNonNull(sessions, "Session Map may not be null");
}

/**
Expand Down

0 comments on commit 51f6a58

Please sign in to comment.