Class UpgradeableSessionTracker
java.lang.Object
org.apache.zookeeper.server.quorum.UpgradeableSessionTracker
- All Implemented Interfaces:
SessionTracker
- Direct Known Subclasses:
LeaderSessionTracker,LearnerSessionTracker
A session tracker that supports upgradeable local sessions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.zookeeper.server.SessionTracker
SessionTracker.Session, SessionTracker.SessionExpirer -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckGlobalSession(long sessionId, Object owner) Strictly check that a given session is a global session or notvoidcreateLocalSessionTracker(SessionTracker.SessionExpirer expirer, int tickTime, long id, ZooKeeperServerListener listener) voidfinishedUpgrading(long sessionId) longIf this session tracker supports local sessions, return how many.abstract booleanisGlobalSession(long sessionId) booleanisLocalSession(long sessionId) booleanbooleanisTrackingSession(long sessionId) booleanisUpgradingSession(long sessionId) Get a set of local session IDsprotected voidremoveLocalSession(long sessionId) voidstart()intupgradeSession(long sessionId) Upgrades the session to a global session.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.zookeeper.server.SessionTracker
checkSession, commitSession, createSession, dumpSessions, getSessionExpiryMap, globalSessions, removeSession, setOwner, setSessionClosing, shutdown, touchSession, trackSession
-
Field Details
-
localSessionTracker
-
localSessionsEnabled
protected boolean localSessionsEnabled
-
-
Constructor Details
-
UpgradeableSessionTracker
public UpgradeableSessionTracker()
-
-
Method Details
-
start
public void start() -
createLocalSessionTracker
public void createLocalSessionTracker(SessionTracker.SessionExpirer expirer, int tickTime, long id, ZooKeeperServerListener listener) -
isTrackingSession
public boolean isTrackingSession(long sessionId) - Specified by:
isTrackingSessionin interfaceSessionTracker- Returns:
- whether or not the SessionTracker is aware of this session
-
isLocalSession
public boolean isLocalSession(long sessionId) -
isLocalSessionsEnabled
public boolean isLocalSessionsEnabled()- Specified by:
isLocalSessionsEnabledin interfaceSessionTracker
-
isUpgradingSession
public boolean isUpgradingSession(long sessionId) -
finishedUpgrading
public void finishedUpgrading(long sessionId) -
isGlobalSession
public abstract boolean isGlobalSession(long sessionId) -
upgradeSession
public int upgradeSession(long sessionId) Upgrades the session to a global session. This simply removes the session from the local tracker and marks it as global. It is up to the caller to actually queue up a transaction for the session.- Parameters:
sessionId-- Returns:
- session timeout (-1 if not a local session)
-
removeLocalSession
protected void removeLocalSession(long sessionId) -
checkGlobalSession
public void checkGlobalSession(long sessionId, Object owner) throws KeeperException.SessionExpiredException, KeeperException.SessionMovedException Description copied from interface:SessionTrackerStrictly check that a given session is a global session or not- Specified by:
checkGlobalSessionin interfaceSessionTracker- Throws:
KeeperException.SessionExpiredExceptionKeeperException.SessionMovedException
-
getLocalSessionCount
public long getLocalSessionCount()Description copied from interface:SessionTrackerIf this session tracker supports local sessions, return how many. otherwise returns 0;- Specified by:
getLocalSessionCountin interfaceSessionTracker
-
localSessions
Description copied from interface:SessionTrackerGet a set of local session IDs- Specified by:
localSessionsin interfaceSessionTracker
-