Class SessionManager.ManagedSession
java.lang.Object
com.loomcache.server.cp.SessionManager.ManagedSession
- Enclosing class:
SessionManager
Represents a session managed by the SessionManager.
Tracks session lifetime, held resources, and state transitions.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddHeldLock(String lockName) Marks a lock as held by this session.voidaddHeldPermits(String semaphoreName, int permits) Adds semaphore permits held by this session.longGets the creation timestamp.booleanChecks if the session exceeds its TTL.Gets all locks held by this session.Gets all semaphore permits held by this session.longGets the lifetime of this session in milliseconds.voidRecords a heartbeat.booleanisActive()Checks if the session is active (not expired and not closed).booleanisClosed()Checks if the session is closed.booleanChecks if the session has expired.longGets the last heartbeat timestamp.ownerId()Gets the owner ID.voidremoveHeldLock(String lockName) Removes a lock from held locks.voidremoveHeldPermits(String semaphoreName, int permits) Removes semaphore permits held by this session.Gets the session ID.state()Gets the current state.toString()
-
Method Details
-
sessionId
Gets the session ID. -
ownerId
Gets the owner ID. -
createdAt
public long createdAt()Gets the creation timestamp. -
lastHeartbeat
public long lastHeartbeat()Gets the last heartbeat timestamp. -
state
Gets the current state. -
heartbeat
public void heartbeat()Records a heartbeat. -
isActive
public boolean isActive()Checks if the session is active (not expired and not closed). -
isExpired
public boolean isExpired()Checks if the session has expired. -
isClosed
public boolean isClosed()Checks if the session is closed. -
exceedsTimeout
public boolean exceedsTimeout()Checks if the session exceeds its TTL. -
addHeldLock
Marks a lock as held by this session. -
removeHeldLock
Removes a lock from held locks. -
getHeldLocks
-
addHeldPermits
Adds semaphore permits held by this session. -
removeHeldPermits
Removes semaphore permits held by this session. -
getHeldPermits
-
getLifetimeMs
public long getLifetimeMs()Gets the lifetime of this session in milliseconds. -
toString
-