Class SessionManager.ManagedSession

java.lang.Object
com.loomcache.server.cp.SessionManager.ManagedSession
Enclosing class:
SessionManager

public static final class SessionManager.ManagedSession extends Object
Represents a session managed by the SessionManager.

Tracks session lifetime, held resources, and state transitions.

Since:
1.0
  • Method Details

    • sessionId

      public String sessionId()
      Gets the session ID.
    • ownerId

      public String ownerId()
      Gets the owner ID.
    • createdAt

      public long createdAt()
      Gets the creation timestamp.
    • lastHeartbeat

      public long lastHeartbeat()
      Gets the last heartbeat timestamp.
    • state

      public SessionState 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

      public void addHeldLock(String lockName)
      Marks a lock as held by this session.
    • removeHeldLock

      public void removeHeldLock(String lockName)
      Removes a lock from held locks.
    • getHeldLocks

      public Set<String> getHeldLocks()
      Gets all locks held by this session.
    • addHeldPermits

      public void addHeldPermits(String semaphoreName, int permits)
      Adds semaphore permits held by this session.
    • removeHeldPermits

      public void removeHeldPermits(String semaphoreName, int permits)
      Removes semaphore permits held by this session.
    • getHeldPermits

      public Map<String,Integer> getHeldPermits()
      Gets all semaphore permits held by this session.
    • getLifetimeMs

      public long getLifetimeMs()
      Gets the lifetime of this session in milliseconds.
    • toString

      public String toString()
      Overrides:
      toString in class Object