org.apache.catalina.ha.session
public class ReplicatedSession extends StandardSession implements ClusterSession
Modifier and Type | Field and Description |
---|---|
protected boolean |
isDirty |
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
SESSION_ACTIVATED_EVENT, SESSION_CREATED_EVENT, SESSION_DESTROYED_EVENT, SESSION_PASSIVATED_EVENT
Constructor and Description |
---|
ReplicatedSession(Manager manager) |
Modifier and Type | Method and Description |
---|---|
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) |
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.
|
access, activate, addSessionListener, endAccess, exclude, expire, fireContainerEvent, fireSessionEvent, getAttribute, getAttributeNames, getAuthType, getCreationTime, getId, getIdInternal, getInfo, getLastAccessedTimeInternal, getManager, getMaxInactiveInterval, getNote, getNoteNames, getPrincipal, getServletContext, getSession, getSessionContext, getValue, getValueNames, isNew, isValid, isValidInternal, keys, passivate, putValue, readObject, recycle, removeAttributeInternal, removeNote, removeSessionListener, removeValue, setAttribute, setAuthType, setCreationTime, setId, setManager, setNew, setNote, setValid, tellNew, writeObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
access, addSessionListener, endAccess, getAuthType, getCreationTime, getId, getIdInternal, getInfo, getLastAccessedTimeInternal, getManager, getMaxInactiveInterval, getNote, getNoteNames, getPrincipal, getSession, isValid, recycle, removeNote, removeSessionListener, setAuthType, setCreationTime, setId, setManager, setNew, setNote, setValid
public ReplicatedSession(Manager manager)
public boolean isDirty()
public void setIsDirty(boolean dirty)
public void setLastAccessWasDistributed(long time)
public long getLastAccessWasDistributed()
public void removeAttribute(java.lang.String name)
StandardSession
After this method executes, and if the object implements
HttpSessionBindingListener
, the container calls
valueUnbound()
on the object.
removeAttribute
in interface javax.servlet.http.HttpSession
removeAttribute
in class StandardSession
name
- Name of the object to remove from this session.public void removeAttribute(java.lang.String name, boolean notify)
removeAttribute
in class StandardSession
name
- Name of the object to remove from this session.notify
- Should we notify interested listeners that this
attribute is being removed?public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface javax.servlet.http.HttpSession
setAttribute
in class StandardSession
name
- Name to which the object is bound, cannot be nullvalue
- Object to be bound, cannot be nullpublic void setMaxInactiveInterval(int interval)
StandardSession
setMaxInactiveInterval
in interface javax.servlet.http.HttpSession
setMaxInactiveInterval
in interface Session
setMaxInactiveInterval
in class StandardSession
interval
- The new maximum intervalpublic void setManager(SimpleTcpReplicationManager mgr)
mgr
- - the servers InMemoryReplicationManagerpublic void setPrincipal(java.security.Principal principal)
Authenticator
with a means to cache a
previously authenticated Principal, and avoid potentially expensive
Realm.authenticate()
calls on every request.setPrincipal
in interface Session
setPrincipal
in class StandardSession
principal
- The new Principal, or null
if nonepublic void expire()
StandardSession
expire
in interface Session
expire
in class StandardSession
public void invalidate()
StandardSession
invalidate
in interface javax.servlet.http.HttpSession
invalidate
in class StandardSession
public void readObjectData(java.io.ObjectInputStream stream) throws java.lang.ClassNotFoundException, java.io.IOException
readObjectData
in class StandardSession
stream
- The object input stream to read fromjava.lang.ClassNotFoundException
- if an unknown class is specifiedjava.io.IOException
- if an input/output error occurspublic void writeObjectData(java.io.ObjectOutputStream stream) throws java.io.IOException
writeObjectData
in class StandardSession
stream
- The object output stream to write tojava.io.IOException
- if an input/output error occurspublic void setId(java.lang.String id, boolean tellNew)
public boolean isPrimarySession()
isPrimarySession
in interface ClusterSession
public void setPrimarySession(boolean primarySession)
setPrimarySession
in interface ClusterSession
primarySession
- Flag valueprotected void log(java.lang.String message)
protected void log(java.lang.String message, java.lang.Throwable x)
public java.lang.String toString()
StandardSession
toString
in class StandardSession
public int getAccessCount()
public void setAccessCount(int accessCount)
public long getLastAccessedTime()
StandardSession
getLastAccessedTime
in interface javax.servlet.http.HttpSession
getLastAccessedTime
in interface Session
getLastAccessedTime
in class StandardSession
long
representing the last time
the client sent a request associated
with this session, expressed in
milliseconds since 1/1/1970 GMTpublic void setLastAccessedTime(long lastAccessedTime)
public long getThisAccessedTime()
public void setThisAccessedTime(long thisAccessedTime)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.