public class SessionTrackerImpl extends ZooKeeperCriticalThread implements SessionTracker
| Modifier and Type | Class and Description |
|---|---|
static class |
SessionTrackerImpl.SessionImpl |
Thread.State, Thread.UncaughtExceptionHandlerSessionTracker.Session, SessionTracker.SessionExpirer| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentHashMap<Long,SessionTrackerImpl.SessionImpl> |
sessionsById |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
SessionTrackerImpl(SessionTracker.SessionExpirer expirer,
ConcurrentMap<Long,Integer> sessionsWithTimeout,
int tickTime,
long serverId,
ZooKeeperServerListener listener) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addGlobalSession(long id,
int sessionTimeout)
Add a global session to those being tracked.
|
boolean |
addSession(long id,
int sessionTimeout)
Add a session to those being tracked.
|
void |
checkGlobalSession(long sessionId,
Object owner)
Strictly check that a given session is a global session or not
|
void |
checkSession(long sessionId,
Object owner)
Checks whether the SessionTracker is aware of this session, the session
is still active, and the owner matches.
|
long |
createSession(int sessionTimeout) |
void |
dumpSessions(PrintWriter pwriter)
Text dump of session information, suitable for debugging.
|
Map<Long,Set<Long>> |
getSessionExpiryMap()
Returns a mapping from time to session IDs of sessions expiring at that time.
|
int |
getSessionTimeout(long sessionId) |
static long |
initializeNextSession(long id)
Generates an initial sessionId.
|
boolean |
isTrackingSession(long sessionId) |
void |
removeSession(long sessionId) |
void |
run() |
void |
setOwner(long id,
Object owner) |
void |
setSessionClosing(long sessionId)
Mark that the session is in the process of closing.
|
void |
shutdown() |
String |
toString() |
boolean |
touchSession(long sessionId,
int timeout) |
handleExceptionactiveCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yieldprotected final ConcurrentHashMap<Long,SessionTrackerImpl.SessionImpl> sessionsById
public SessionTrackerImpl(SessionTracker.SessionExpirer expirer, ConcurrentMap<Long,Integer> sessionsWithTimeout, int tickTime, long serverId, ZooKeeperServerListener listener)
public static long initializeNextSession(long id)
public void dumpSessions(PrintWriter pwriter)
SessionTrackerdumpSessions in interface SessionTrackerpwriter - the output writerpublic Map<Long,Set<Long>> getSessionExpiryMap()
getSessionExpiryMap in interface SessionTrackerpublic boolean touchSession(long sessionId,
int timeout)
touchSession in interface SessionTrackerpublic int getSessionTimeout(long sessionId)
public void setSessionClosing(long sessionId)
SessionTrackersetSessionClosing in interface SessionTrackerpublic void removeSession(long sessionId)
removeSession in interface SessionTrackerpublic void shutdown()
shutdown in interface SessionTrackerpublic long createSession(int sessionTimeout)
createSession in interface SessionTrackerpublic boolean addGlobalSession(long id,
int sessionTimeout)
SessionTrackeraddGlobalSession in interface SessionTrackerid - sessionIdsessionTimeout - sessionTimeoutpublic boolean addSession(long id,
int sessionTimeout)
SessionTrackeraddSession in interface SessionTrackerid - sessionIdsessionTimeout - sessionTimeoutpublic boolean isTrackingSession(long sessionId)
isTrackingSession in interface SessionTrackerpublic void checkSession(long sessionId,
Object owner)
throws KeeperException.SessionExpiredException,
KeeperException.SessionMovedException,
KeeperException.UnknownSessionException
SessionTrackercheckSession in interface SessionTrackerKeeperException.SessionExpiredExceptionKeeperException.SessionMovedExceptionKeeperException.UnknownSessionExceptionpublic void setOwner(long id,
Object owner)
throws KeeperException.SessionExpiredException
setOwner in interface SessionTrackerKeeperException.SessionExpiredExceptionpublic void checkGlobalSession(long sessionId,
Object owner)
throws KeeperException.SessionExpiredException,
KeeperException.SessionMovedException
SessionTrackercheckGlobalSession in interface SessionTrackerKeeperException.SessionExpiredExceptionKeeperException.SessionMovedExceptionCopyright © 2008–2019 The Apache Software Foundation. All rights reserved.