org.apache.zookeeper.server
Class SessionTrackerImpl
java.lang.Object
java.lang.Thread
org.apache.zookeeper.server.SessionTrackerImpl
- All Implemented Interfaces:
- Runnable, SessionTracker
public class SessionTrackerImpl
- extends Thread
- implements SessionTracker
This is a full featured SessionTracker. It tracks session in grouped by tick
interval. It always rounds up the tick interval to provide a sort of grace
period. Sessions are thus expired in batches made up of sessions that expire
in a given interval.
Methods inherited from class java.lang.Thread |
activeCount, 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, yield |
SessionTrackerImpl
public SessionTrackerImpl(SessionTracker.SessionExpirer expirer,
ConcurrentHashMap<Long,Integer> sessionsWithTimeout,
int tickTime,
long sid)
initializeNextSession
public static long initializeNextSession(long id)
dumpSessions
public void dumpSessions(PrintWriter pwriter)
- Description copied from interface:
SessionTracker
- Text dump of session information, suitable for debugging.
- Specified by:
dumpSessions
in interface SessionTracker
- Parameters:
pwriter
- the output writer
toString
public String toString()
- Overrides:
toString
in class Thread
run
public void run()
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread
touchSession
public boolean touchSession(long sessionId,
int timeout)
- Specified by:
touchSession
in interface SessionTracker
- Returns:
- false if session is no longer active
setSessionClosing
public void setSessionClosing(long sessionId)
- Description copied from interface:
SessionTracker
- Mark that the session is in the process of closing.
- Specified by:
setSessionClosing
in interface SessionTracker
removeSession
public void removeSession(long sessionId)
- Specified by:
removeSession
in interface SessionTracker
shutdown
public void shutdown()
- Specified by:
shutdown
in interface SessionTracker
createSession
public long createSession(int sessionTimeout)
- Specified by:
createSession
in interface SessionTracker
addSession
public void addSession(long id,
int sessionTimeout)
- Specified by:
addSession
in interface SessionTracker
checkSession
public void checkSession(long sessionId,
Object owner)
throws KeeperException.SessionExpiredException,
KeeperException.SessionMovedException
- Specified by:
checkSession
in interface SessionTracker
- Throws:
KeeperException.SessionExpiredException
KeeperException.SessionMovedException
setOwner
public void setOwner(long id,
Object owner)
throws KeeperException.SessionExpiredException
- Specified by:
setOwner
in interface SessionTracker
- Throws:
KeeperException.SessionExpiredException
Copyright © 2012 The Apache Software Foundation