Ensure SessionCache and SessionDataStore are managed as beans
This commit is contained in:
parent
7fd93f1929
commit
49ce555add
|
@ -25,7 +25,7 @@ import java.util.Set;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.Locker.Lock;
|
||||
|
@ -51,7 +51,7 @@ import org.eclipse.jetty.util.thread.Locker.Lock;
|
|||
* passivated before eviction from the cache.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractSessionCache extends AbstractLifeCycle implements SessionCache
|
||||
public abstract class AbstractSessionCache extends ContainerLifeCycle implements SessionCache
|
||||
{
|
||||
final static Logger LOG = Log.getLogger("org.eclipse.jetty.server.session");
|
||||
|
||||
|
@ -204,10 +204,7 @@ public abstract class AbstractSessionCache extends AbstractLifeCycle implements
|
|||
if (_context == null)
|
||||
throw new IllegalStateException ("No ContextId");
|
||||
|
||||
_sessionDataStore.initialize(_context);
|
||||
_sessionDataStore.start();
|
||||
|
||||
|
||||
_sessionDataStore.initialize(_context);
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
|
@ -234,6 +231,7 @@ public abstract class AbstractSessionCache extends AbstractLifeCycle implements
|
|||
*/
|
||||
public void setSessionDataStore(SessionDataStore sessionStore)
|
||||
{
|
||||
updateBean(_sessionDataStore, sessionStore);
|
||||
_sessionDataStore = sessionStore;
|
||||
}
|
||||
|
||||
|
|
|
@ -412,11 +412,7 @@ public class SessionHandler extends ScopedHandler
|
|||
if (_sessionCache == null)
|
||||
{
|
||||
SessionCacheFactory ssFactory = server.getBean(SessionCacheFactory.class);
|
||||
if (ssFactory != null)
|
||||
_sessionCache = ssFactory.getSessionCache(this);
|
||||
else
|
||||
_sessionCache = new DefaultSessionCache(this);
|
||||
|
||||
setSessionCache(ssFactory != null?ssFactory.getSessionCache(this):new DefaultSessionCache(this));
|
||||
SessionDataStore sds = null;
|
||||
SessionDataStoreFactory sdsFactory = server.getBean(SessionDataStoreFactory.class);
|
||||
if (sdsFactory != null)
|
||||
|
@ -499,10 +495,8 @@ public class SessionHandler extends ScopedHandler
|
|||
_checkingRemoteSessionIdEncoding=Boolean.parseBoolean(tmp);
|
||||
}
|
||||
|
||||
_sessionContext = new SessionContext(_sessionIdManager.getWorkerName(), _context);
|
||||
|
||||
_sessionContext = new SessionContext(_sessionIdManager.getWorkerName(), _context);
|
||||
_sessionCache.initialize(_sessionContext);
|
||||
_sessionCache.start();
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
|
@ -1008,8 +1002,12 @@ public class SessionHandler extends ScopedHandler
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param cache
|
||||
*/
|
||||
public void setSessionCache (SessionCache cache)
|
||||
{
|
||||
updateBean(_sessionCache, cache);
|
||||
_sessionCache = cache;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue