jrun.servlet.session
Class SessionHolder

java.lang.Object
  |
  +--jrun.servlet.session.SessionHolder
All Implemented Interfaces:
java.lang.Runnable

public final class SessionHolder
extends java.lang.Object
implements java.lang.Runnable

Represents a single session object. The session object may be resident in memory, or it may have been swapped to disk.


Field Summary
protected  long expireTime
           
protected  long inactiveMS
           
protected  JRunSession inMemorySession
           
protected  long lastAccessMS
           
protected  int lruID
           
protected  Session service
           
protected  java.lang.String sessionID
           
protected  int state
           
static int STATE_INMEMORY
           
static int STATE_INVALID
           
static int STATE_LOST
           
static int STATE_SWAPPED
           
 
Constructor Summary
SessionHolder(Session service, JRunSession session)
          Construct a new SessionHolder
SessionHolder(Session service, java.lang.String sessionID)
          Construct a new SessionHolder
 
Method Summary
protected  int getLRUID()
           
 JRunSession getSession()
          Gets the session object.
 java.lang.String getSessionID()
           
protected  boolean isInMemory()
           
protected  boolean isSwapped()
           
protected  void reschedule(long inactiveMS)
          Reschedule the timer for the session invalidation
 void run()
          Called by the Scheduler to perform session invalidation
protected  void setLastAccessTime(long ms)
          Sets the last accessed time
protected  void setLRUID(int id)
           
 void setSession(JRunSession session)
           
protected  void setState(int state)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_INMEMORY

public static final int STATE_INMEMORY

STATE_SWAPPED

public static final int STATE_SWAPPED

STATE_LOST

public static final int STATE_LOST

STATE_INVALID

public static final int STATE_INVALID

service

protected Session service

state

protected int state

lastAccessMS

protected long lastAccessMS

inactiveMS

protected long inactiveMS

expireTime

protected long expireTime

lruID

protected int lruID

inMemorySession

protected JRunSession inMemorySession

sessionID

protected java.lang.String sessionID
Constructor Detail

SessionHolder

public SessionHolder(Session service,
                     java.lang.String sessionID)
Construct a new SessionHolder
Parameters:
service - The JRunSessionService
sessionID - The session ID

SessionHolder

public SessionHolder(Session service,
                     JRunSession session)
Construct a new SessionHolder
Parameters:
service - The JRunSessionService
session - The session object
Method Detail

getSession

public JRunSession getSession()
Gets the session object. If the session has been swapped to disk, request the object from the storage provider.
Returns:
null if the session could not be loaded

setSession

public void setSession(JRunSession session)

getSessionID

public java.lang.String getSessionID()

reschedule

protected void reschedule(long inactiveMS)
Reschedule the timer for the session invalidation
Parameters:
inactiveMS - The milliseconds of inactivity before invalidating

setLastAccessTime

protected void setLastAccessTime(long ms)
Sets the last accessed time

setLRUID

protected void setLRUID(int id)

getLRUID

protected int getLRUID()

setState

protected void setState(int state)

isInMemory

protected boolean isInMemory()

isSwapped

protected boolean isSwapped()

run

public void run()
Called by the Scheduler to perform session invalidation
Specified by:
run in interface java.lang.Runnable


Copyright � 2002 Macromedia Corporation. All Rights Reserved.