public class GCloudSessionManager extends AbstractSessionManager
| Modifier and Type | Class and Description |
|---|---|
protected class |
GCloudSessionManager.Scavenger
Scavenger
|
class |
GCloudSessionManager.Session
Session
Representation of a session in local memory.
|
class |
GCloudSessionManager.SessionEntityConverter
SessionEntityConverter
|
AbstractSessionManager.CookieConfig, AbstractSessionManager.SessionIfAbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_ownScheduler |
protected long |
_scavengeIntervalMs |
protected GCloudSessionManager.Scavenger |
_scavenger |
protected Scheduler |
_scheduler |
protected Scheduler.Task |
_task |
static int |
DEFAULT_BACKOFF_MS |
static int |
DEFAULT_MAX_QUERY_RESULTS |
static int |
DEFAULT_MAX_RETRIES |
static long |
DEFAULT_SCAVENGE_SEC |
static String |
KIND |
__defaultSessionTrackingModes, __distantFuture, _checkingRemoteSessionIdEncoding, _context, _dftMaxIdleSecs, _httpOnly, _loader, _maxCookieAge, _nodeIdInSessionId, _refreshCookieAge, _secureCookies, _secureRequestOnly, _sessionAttributeListeners, _sessionComment, _sessionCookie, _sessionDomain, _sessionHandler, _sessionIdListeners, _sessionIdManager, _sessionIdPathParameterName, _sessionIdPathParameterNamePrefix, _sessionListeners, _sessionPath, _sessionsStats, _sessionTimeStats, _sessionTrackingModes, MAX_INACTIVE_MINUTESFAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING__CheckRemoteSessionEncoding, __DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionIdPathParameterName, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionIdPathParameterNameProperty, __SessionPathProperty| Constructor and Description |
|---|
GCloudSessionManager() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addSession(AbstractSession session)
Add a new session for the context related to this session manager
|
protected String |
canonicalizeKey(String id,
ContextHandler.Context context)
Make a unique string from the session id and info from its Context
|
protected void |
delete(GCloudSessionManager.Session session)
Remove the session from the cluster cache.
|
void |
doStart()
Start the session manager.
|
void |
doStop()
Stop the session manager.
|
int |
getBackoffMs() |
int |
getMaxResults() |
int |
getMaxRetries() |
long |
getScavengeIntervalSec() |
AbstractSession |
getSession(String idInCluster)
Ask the cluster for the session.
|
long |
getStaleIntervalSec() |
void |
invalidateSession(String idInCluster)
Invalidate a session for this context with the given id
|
protected GCloudSessionManager.Session |
load(com.google.cloud.datastore.Key key)
Load a session from the clustered cache.
|
protected com.google.cloud.datastore.Key |
makeKey(GCloudSessionManager.Session session,
ContextHandler.Context context)
Make a unique key for this session.
|
protected com.google.cloud.datastore.Key |
makeKey(String id,
ContextHandler.Context context)
Make a unique key for this session.
|
protected AbstractSession |
newSession(javax.servlet.http.HttpServletRequest request)
Create a new session instance
|
protected boolean |
removeSession(String idInCluster)
Remove a session from local memory, and delete it from
the cluster cache.
|
void |
renewSessionId(String oldClusterId,
String oldNodeId,
String newClusterId,
String newNodeId)
Tell the HttpSessionIdListeners the id changed.
|
protected void |
save(GCloudSessionManager.Session session)
Save or update the session to the cluster cache
|
void |
scavenge()
Look for sessions in local memory that have expired.
|
protected void |
scavengeGCloudDataStore() |
protected void |
scavengeSession(com.google.cloud.datastore.Entity e)
Scavenge a session that has expired
|
void |
setBackoffMs(int backoffMs) |
void |
setDatastore(com.google.cloud.datastore.Datastore datastore) |
void |
setMaxResults(int maxResults) |
void |
setMaxRetries(int maxRetries) |
void |
setScavengeIntervalSec(long sec)
Set the interval between runs of the scavenger.
|
void |
setStaleIntervalSec(long staleIntervalSec) |
protected void |
shutdownSessions()
The session manager is stopping.
|
access, addEventListener, addSession, clearEventListeners, complete, doSessionAttributeListeners, getClusterId, getContext, getContextHandler, getDefaultSessionTrackingModes, getEffectiveSessionTrackingModes, getHttpOnly, getHttpSession, getMaxCookieAge, getMaxInactiveInterval, getMetaManager, getNodeId, getRefreshCookieAge, getSecureCookies, getSessionCookie, getSessionCookie, getSessionCookieConfig, getSessionDomain, getSessionHandler, getSessionIdManager, getSessionIdPathParameterName, getSessionIdPathParameterNamePrefix, getSessionPath, getSessions, getSessionsMax, getSessionsTotal, getSessionTimeMax, getSessionTimeMean, getSessionTimeStdDev, getSessionTimeTotal, isCheckingRemoteSessionIdEncoding, isNodeIdInSessionId, isSecureRequestOnly, isUsingCookies, isUsingURLs, isValid, newHttpSession, removeEventListener, removeSession, removeSession, setCheckingRemoteSessionIdEncoding, setHttpOnly, setMaxInactiveInterval, setNodeIdInSessionId, setRefreshCookieAge, setSecureRequestOnly, setSessionCookie, setSessionHandler, setSessionIdManager, setSessionIdPathParameterName, setSessionTrackingModes, setUsingCookies, statsResetaddBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stoppublic static final String KIND
public static final int DEFAULT_MAX_QUERY_RESULTS
public static final long DEFAULT_SCAVENGE_SEC
public static final int DEFAULT_BACKOFF_MS
public static final int DEFAULT_MAX_RETRIES
protected Scheduler.Task _task
protected Scheduler _scheduler
protected GCloudSessionManager.Scavenger _scavenger
protected long _scavengeIntervalMs
protected boolean _ownScheduler
public void setDatastore(com.google.cloud.datastore.Datastore datastore)
public void doStart()
throws Exception
doStart in class AbstractSessionManagerExceptionAbstractSessionManager.doStart()public void doStop()
throws Exception
doStop in class AbstractSessionManagerExceptionAbstractSessionManager.doStop()public void scavenge()
protected void scavengeSession(com.google.cloud.datastore.Entity e)
throws Exception
e - the session info from datastoreExceptionpublic long getScavengeIntervalSec()
public void setScavengeIntervalSec(long sec)
sec - the number of seconds between scavenge cyclespublic long getStaleIntervalSec()
public void setStaleIntervalSec(long staleIntervalSec)
public int getMaxResults()
public void setMaxResults(int maxResults)
protected void addSession(AbstractSession session)
addSession in class AbstractSessionManagerAbstractSessionManager.addSession(org.eclipse.jetty.server.session.AbstractSession)public AbstractSession getSession(String idInCluster)
getSession in class AbstractSessionManageridInCluster - The session ID in the cluster, stripped of any worker name.AbstractSessionManager.getSession(java.lang.String)protected void shutdownSessions()
throws Exception
shutdownSessions in class AbstractSessionManagerException - if unable to shutdown sesssionsAbstractSessionManager.shutdownSessions()protected AbstractSession newSession(javax.servlet.http.HttpServletRequest request)
AbstractSessionManagernewSession in class AbstractSessionManagerrequest - the request to build the session fromprotected boolean removeSession(String idInCluster)
removeSession in class AbstractSessionManagerAbstractSessionManager.removeSession(java.lang.String)public void renewSessionId(String oldClusterId, String oldNodeId, String newClusterId, String newNodeId)
AbstractSessionManagerrenewSessionId in interface SessionManagerrenewSessionId in class AbstractSessionManageroldClusterId - the old cluster idoldNodeId - the old node idnewClusterId - the new cluster idnewNodeId - the new node idSessionManager.renewSessionId(java.lang.String, java.lang.String, java.lang.String, java.lang.String)protected GCloudSessionManager.Session load(com.google.cloud.datastore.Key key) throws Exception
key - the unique datastore key for the sessionExceptionprotected void save(GCloudSessionManager.Session session) throws Exception
session - the session to save to datastoreExceptionpublic int getMaxRetries()
public int getBackoffMs()
public void setBackoffMs(int backoffMs)
backoffMs - the backoffMs to setpublic void setMaxRetries(int maxRetries)
maxRetries - the maxRetries to setprotected void delete(GCloudSessionManager.Session session)
session - the session to delete from datastorepublic void invalidateSession(String idInCluster)
idInCluster - the id of the session to invalidateprotected com.google.cloud.datastore.Key makeKey(GCloudSessionManager.Session session, ContextHandler.Context context)
session - the session for which the key should be createdcontext - the context to which the session belongsprotected com.google.cloud.datastore.Key makeKey(String id, ContextHandler.Context context)
id - the id of the session for which the key should be createdcontext - the context to which the session belongsprotected String canonicalizeKey(String id, ContextHandler.Context context)
id - the id of the Sessioncontext - the Context in which the Session existsCopyright © 1995–2021 Webtide. All rights reserved.