public class LearnerSessionTracker extends UpgradeableSessionTracker
SessionTracker.Session, SessionTracker.SessionExpirer
localSessionsEnabled, localSessionTracker
Constructor and Description |
---|
LearnerSessionTracker(SessionTracker.SessionExpirer expirer,
ConcurrentMap<Long,Integer> sessionsWithTimeouts,
int tickTime,
long id,
boolean localSessionsEnabled,
ZooKeeperServerListener listener) |
Modifier and Type | Method and Description |
---|---|
void |
checkSession(long sessionId,
Object owner)
Checks whether the SessionTracker is aware of this session, the session
is still active, and the owner matches.
|
boolean |
commitSession(long sessionId,
int sessionTimeout)
Synchronized on this to avoid race condition of adding a local session
after committed global session, which may cause the same session being
tracked on this server and leader.
|
long |
createSession(int sessionTimeout) |
void |
dumpSessions(PrintWriter pwriter)
Text dump of session information, suitable for debugging.
|
Map<Long,Set<Long>> |
getSessionExpiryMap()
Returns a mapping of time to session IDs that expire at that time.
|
Set<Long> |
globalSessions()
Get a set of global session IDs
|
boolean |
isGlobalSession(long sessionId) |
void |
removeSession(long sessionId) |
void |
setOwner(long sessionId,
Object owner) |
void |
setSessionClosing(long sessionId)
Mark that the session is in the process of closing.
|
void |
shutdown() |
Map<Long,Integer> |
snapshot() |
void |
start() |
boolean |
touchSession(long sessionId,
int sessionTimeout) |
boolean |
trackSession(long sessionId,
int sessionTimeout)
Track the session expire, not add to ZkDb.
|
checkGlobalSession, createLocalSessionTracker, finishedUpgrading, getLocalSessionCount, isLocalSession, isLocalSessionsEnabled, isTrackingSession, isUpgradingSession, localSessions, removeLocalSession, upgradeSession
public LearnerSessionTracker(SessionTracker.SessionExpirer expirer, ConcurrentMap<Long,Integer> sessionsWithTimeouts, int tickTime, long id, boolean localSessionsEnabled, ZooKeeperServerListener listener)
public void removeSession(long sessionId)
public void start()
start
in class UpgradeableSessionTracker
public void shutdown()
public boolean isGlobalSession(long sessionId)
isGlobalSession
in class UpgradeableSessionTracker
public boolean trackSession(long sessionId, int sessionTimeout)
SessionTracker
sessionId
- sessionIdsessionTimeout
- sessionTimeoutpublic boolean commitSession(long sessionId, int sessionTimeout)
sessionId
- sessionIdsessionTimeout
- sessionTimeoutpublic boolean touchSession(long sessionId, int sessionTimeout)
public long createSession(int sessionTimeout)
public void checkSession(long sessionId, Object owner) throws KeeperException.SessionExpiredException, KeeperException.SessionMovedException
SessionTracker
public void setOwner(long sessionId, Object owner) throws KeeperException.SessionExpiredException
public void dumpSessions(PrintWriter pwriter)
SessionTracker
pwriter
- the output writerpublic void setSessionClosing(long sessionId)
SessionTracker
public Map<Long,Set<Long>> getSessionExpiryMap()
SessionTracker
public Set<Long> globalSessions()
SessionTracker
Copyright © 2008–2023 The Apache Software Foundation. All rights reserved.