diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionCache.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionCache.java index d67cca276b6..acef8b434b4 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionCache.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionCache.java @@ -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; @@ -52,12 +53,12 @@ public class DefaultSessionCache extends AbstractSessionCache /** * @param manager The SessionHandler related to this SessionCache - * @param sessionMap The session map implementation to use + * @param sessions The session map implementation to use */ - public DefaultSessionCache(SessionHandler manager, ConcurrentMap sessionMap) + public DefaultSessionCache(SessionHandler manager, ConcurrentMap sessions) { super(manager); - this._sessions = sessionMap; + _sessions = Objects.requireNonNull(sessions, "Session Map may not be null"); } /** @@ -194,4 +195,11 @@ public class DefaultSessionCache extends AbstractSessionCache { return _sessions.replace(id, oldValue, newValue); } + + @Override + protected void doStart() throws Exception + { + Objects.requireNonNull(_sessions, "Session Map may not be null"); + super.doStart(); + } }