Apache Tomcat 6.0.53

org.apache.catalina.ha.session
Class ReplicatedSession

java.lang.Object
  extended by org.apache.catalina.session.StandardSession
      extended by org.apache.catalina.ha.session.ReplicatedSession
All Implemented Interfaces:
java.io.Serializable, javax.servlet.http.HttpSession, ClusterSession, Session

public class ReplicatedSession
extends StandardSession
implements ClusterSession

See Also:
Serialized Form

Field Summary
protected  boolean isDirty
           
 
Fields inherited from class org.apache.catalina.session.StandardSession
accessCount, ACTIVITY_CHECK, attributes, authType, creationTime, EMPTY_ARRAY, excludedAttributes, expiring, facade, id, info, isNew, isValid, lastAccessedTime, listeners, manager, maxInactiveInterval, NOT_SERIALIZED, notes, principal, sessionContext, sm, support, thisAccessedTime
 
Fields inherited from interface org.apache.catalina.Session
SESSION_ACTIVATED_EVENT, SESSION_CREATED_EVENT, SESSION_DESTROYED_EVENT, SESSION_PASSIVATED_EVENT
 
Constructor Summary
ReplicatedSession(Manager manager)
           
 
Method Summary
 void expire()
          Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.
 int getAccessCount()
           
 long getLastAccessedTime()
          Return the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT.
 long getLastAccessWasDistributed()
           
 long getThisAccessedTime()
           
 void invalidate()
          Invalidates this session and unbinds any objects bound to it.
 boolean isDirty()
           
 boolean isPrimarySession()
          returns true if this session is the primary session, if that is the case, the manager can expire it upon timeout.
protected  void log(java.lang.String message)
          Implements a log method to log through the manager
protected  void log(java.lang.String message, java.lang.Throwable x)
           
 void readObjectData(java.io.ObjectInputStream stream)
          Read a serialized version of the contents of this session object from the specified object input stream, without requiring that the StandardSession itself have been serialized.
 void removeAttribute(java.lang.String name)
          Remove the object bound with the specified name from this session.
 void removeAttribute(java.lang.String name, boolean notify)
          see parent description, plus we also notify other nodes in the cluster
 void setAccessCount(int accessCount)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
          Sets an attribute and notifies the other nodes in the cluster
 void setId(java.lang.String id, boolean tellNew)
          Set the session identifier for this session and optionally notifies any associated listeners that a new session has been created.
 void setIsDirty(boolean dirty)
           
 void setLastAccessedTime(long lastAccessedTime)
           
 void setLastAccessWasDistributed(long time)
           
 void setManager(SimpleTcpReplicationManager mgr)
          Sets the manager for this session
 void setMaxInactiveInterval(int interval)
          Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session.
 void setPrimarySession(boolean primarySession)
          Sets whether this is the primary session or not.
 void setPrincipal(java.security.Principal principal)
          Set the authenticated Principal that is associated with this Session.
 void setThisAccessedTime(long thisAccessedTime)
           
 java.lang.String toString()
          Return a string representation of this object.
 void writeObjectData(java.io.ObjectOutputStream stream)
          Write a serialized version of the contents of this session object to the specified object output stream, without requiring that the StandardSession itself have been serialized.
 
Methods inherited from class org.apache.catalina.session.StandardSession
access, activate, addSessionListener, endAccess, exclude, exclude, expire, fireContainerEvent, fireSessionEvent, getAttribute, getAttributeNames, getAuthType, getCreationTime, getId, getIdInternal, getInfo, getLastAccessedTimeInternal, getManager, getMaxInactiveInterval, getNote, getNoteNames, getPrincipal, getServletContext, getSession, getSessionContext, getValue, getValueNames, isAttributeDistributable, isNew, isValid, isValidInternal, keys, passivate, putValue, readObject, recycle, removeAttributeInternal, removeNote, removeSessionListener, removeValue, setAttribute, setAuthType, setCreationTime, setId, setManager, setNew, setNote, setValid, tellNew, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Session
access, addSessionListener, endAccess, getAuthType, getCreationTime, getId, getIdInternal, getInfo, getLastAccessedTimeInternal, getManager, getMaxInactiveInterval, getNote, getNoteNames, getPrincipal, getSession, isAttributeDistributable, isValid, recycle, removeNote, removeSessionListener, setAuthType, setCreationTime, setId, setManager, setNew, setNote, setValid
 
Methods inherited from interface javax.servlet.http.HttpSession
getAttribute, getAttributeNames, getCreationTime, getId, getMaxInactiveInterval, getServletContext, getSessionContext, getValue, getValueNames, isNew, putValue, removeValue
 

Field Detail

isDirty

protected boolean isDirty
Constructor Detail

ReplicatedSession

public ReplicatedSession(Manager manager)
Method Detail

isDirty

public boolean isDirty()

setIsDirty

public void setIsDirty(boolean dirty)

setLastAccessWasDistributed

public void setLastAccessWasDistributed(long time)

getLastAccessWasDistributed

public long getLastAccessWasDistributed()

removeAttribute

public void removeAttribute(java.lang.String name)
Description copied from class: StandardSession
Remove the object bound with the specified name from this session. If the session does not have an object bound with this name, this method does nothing.

After this method executes, and if the object implements HttpSessionBindingListener, the container calls valueUnbound() on the object.

Specified by:
removeAttribute in interface javax.servlet.http.HttpSession
Overrides:
removeAttribute in class StandardSession
Parameters:
name - Name of the object to remove from this session.

removeAttribute

public void removeAttribute(java.lang.String name,
                            boolean notify)
see parent description, plus we also notify other nodes in the cluster

Overrides:
removeAttribute in class StandardSession
Parameters:
name - Name of the object to remove from this session.
notify - Should we notify interested listeners that this attribute is being removed?

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Sets an attribute and notifies the other nodes in the cluster

Specified by:
setAttribute in interface javax.servlet.http.HttpSession
Overrides:
setAttribute in class StandardSession
Parameters:
name - Name to which the object is bound, cannot be null
value - Object to be bound, cannot be null

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
Description copied from class: StandardSession
Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out.

Specified by:
setMaxInactiveInterval in interface javax.servlet.http.HttpSession
Specified by:
setMaxInactiveInterval in interface Session
Overrides:
setMaxInactiveInterval in class StandardSession
Parameters:
interval - The new maximum interval

setManager

public void setManager(SimpleTcpReplicationManager mgr)
Sets the manager for this session

Parameters:
mgr - - the servers InMemoryReplicationManager

setPrincipal

public void setPrincipal(java.security.Principal principal)
Set the authenticated Principal that is associated with this Session. This provides an Authenticator with a means to cache a previously authenticated Principal, and avoid potentially expensive Realm.authenticate() calls on every request.

Specified by:
setPrincipal in interface Session
Overrides:
setPrincipal in class StandardSession
Parameters:
principal - The new Principal, or null if none

expire

public void expire()
Description copied from class: StandardSession
Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.

Specified by:
expire in interface Session
Overrides:
expire in class StandardSession

invalidate

public void invalidate()
Description copied from class: StandardSession
Invalidates this session and unbinds any objects bound to it.

Specified by:
invalidate in interface javax.servlet.http.HttpSession
Overrides:
invalidate in class StandardSession

readObjectData

public void readObjectData(java.io.ObjectInputStream stream)
                    throws java.lang.ClassNotFoundException,
                           java.io.IOException
Read a serialized version of the contents of this session object from the specified object input stream, without requiring that the StandardSession itself have been serialized.

Overrides:
readObjectData in class StandardSession
Parameters:
stream - The object input stream to read from
Throws:
java.lang.ClassNotFoundException - if an unknown class is specified
java.io.IOException - if an input/output error occurs

writeObjectData

public void writeObjectData(java.io.ObjectOutputStream stream)
                     throws java.io.IOException
Write a serialized version of the contents of this session object to the specified object output stream, without requiring that the StandardSession itself have been serialized.

Overrides:
writeObjectData in class StandardSession
Parameters:
stream - The object output stream to write to
Throws:
java.io.IOException - if an input/output error occurs

setId

public void setId(java.lang.String id,
                  boolean tellNew)
Description copied from class: StandardSession
Set the session identifier for this session and optionally notifies any associated listeners that a new session has been created.

Specified by:
setId in interface Session
Overrides:
setId in class StandardSession
Parameters:
id - The new session identifier
tellNew - Should any associated listeners be notified that a new session has been created?

isPrimarySession

public boolean isPrimarySession()
returns true if this session is the primary session, if that is the case, the manager can expire it upon timeout.

Specified by:
isPrimarySession in interface ClusterSession
Returns:
True if this session is primary

setPrimarySession

public void setPrimarySession(boolean primarySession)
Sets whether this is the primary session or not.

Specified by:
setPrimarySession in interface ClusterSession
Parameters:
primarySession - Flag value

log

protected void log(java.lang.String message)
Implements a log method to log through the manager


log

protected void log(java.lang.String message,
                   java.lang.Throwable x)

toString

public java.lang.String toString()
Description copied from class: StandardSession
Return a string representation of this object.

Overrides:
toString in class StandardSession

getAccessCount

public int getAccessCount()

setAccessCount

public void setAccessCount(int accessCount)

getLastAccessedTime

public long getLastAccessedTime()
Description copied from class: StandardSession
Return the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.

Specified by:
getLastAccessedTime in interface javax.servlet.http.HttpSession
Specified by:
getLastAccessedTime in interface Session
Overrides:
getLastAccessedTime in class StandardSession
Returns:
a long representing the last time the client sent a request associated with this session, expressed in milliseconds since 1/1/1970 GMT

setLastAccessedTime

public void setLastAccessedTime(long lastAccessedTime)

getThisAccessedTime

public long getThisAccessedTime()

setThisAccessedTime

public void setThisAccessedTime(long thisAccessedTime)

Apache Tomcat 6.0.53

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.