public class DeltaSession extends StandardSession implements Externalizable, ClusterSession, ReplicatedMapEntry
| Modifier and Type | Field and Description |
|---|---|
protected Lock |
diffLock |
static Log |
log |
protected static StringManager |
sm
The string manager for this package.
|
accessCount, ACTIVITY_CHECK, attributes, authType, creationTime, EMPTY_ARRAY, excludedAttributes, expiring, facade, id, isNew, isValid, LAST_ACCESS_AT_START, lastAccessedTime, listeners, manager, maxInactiveInterval, NOT_SERIALIZED, notes, principal, sessionContext, STRICT_SERVLET_COMPLIANCE, support, thisAccessedTimeSESSION_ACTIVATED_EVENT, SESSION_CREATED_EVENT, SESSION_DESTROYED_EVENT, SESSION_PASSIVATED_EVENT| Constructor and Description |
|---|
DeltaSession() |
DeltaSession(Manager manager)
Construct a new Session associated with the specified Manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accessEntry()
Access to an existing object.
|
void |
addSessionListener(SessionListener listener)
Add a session event listener to this component.
|
void |
addSessionListener(SessionListener listener,
boolean addDeltaRequest) |
void |
applyDiff(byte[] diff,
int offset,
int length)
Applies a diff to an existing object.
|
protected void |
doReadObject(ObjectInputStream stream)
Read a serialized version of this session object from the specified
object input stream.
|
protected void |
doWriteObject(ObjectOutputStream stream)
Write a serialized version of this session object to the specified object
output stream.
|
void |
endAccess()
End the access and register to ReplicationValve (crossContext support)
|
protected boolean |
exclude(String name)
Exclude attributes from replication.
|
void |
expire(boolean notify)
Perform the internal processing required to invalidate this session,
without triggering an exception if the session has already expired.
|
void |
expire(boolean notify,
boolean notifyCluster) |
ClassLoader[] |
getClassLoaders() |
DeltaRequest |
getDeltaRequest() |
byte[] |
getDiff()
Returns a diff and sets the dirty map to false
|
long |
getLastTimeReplicated()
Return the last replicate time.
|
long |
getVersion()
For accuracy checking, a serialized attribute can contain a version number
This number increases as modifications are made to the data.
|
boolean |
isAccessReplicate()
If this returns true, to replicate that an object has been accessed
|
protected boolean |
isAttributeDistributable(String name,
Object value)
Check whether the Object can be distributed.
|
boolean |
isDiffable()
If this returns true, the map will extract the diff using getDiff()
Otherwise it will serialize the entire object.
|
boolean |
isDirty()
Has the object changed since last replication
and is not in a locked state
|
boolean |
isPrimarySession()
returns true if this session is the primary session, if that is the case,
the manager can expire it upon timeout.
|
boolean |
isValid()
Return the
isValid flag for this session. |
void |
lock()
Lock during serialization
|
void |
readExternal(ObjectInput in) |
void |
readObjectData(ObjectInput stream) |
void |
readObjectData(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 |
recycle()
Release all object references, and initialize instance variables, in
preparation for reuse of this object.
|
void |
removeAttribute(String name,
boolean notify)
Remove the object bound with the specified name from this session.
|
void |
removeAttribute(String name,
boolean notify,
boolean addDeltaRequest) |
protected void |
removeAttributeInternal(String name,
boolean notify,
boolean addDeltaRequest) |
void |
removeSessionListener(SessionListener listener)
Remove a session event listener from this component.
|
void |
removeSessionListener(SessionListener listener,
boolean addDeltaRequest) |
void |
resetDeltaRequest() |
void |
resetDiff()
Resets the current diff state and resets the dirty flag
|
protected void |
setAccessCount(int count) |
void |
setAttribute(String name,
Object value)
Bind an object to this session, using the specified name.
|
void |
setAttribute(String name,
Object value,
boolean notify,
boolean addDeltaRequest) |
void |
setAuthType(String authType)
Set the authentication type used to authenticate our cached
Principal, if any.
|
void |
setAuthType(String authType,
boolean addDeltaRequest) |
void |
setId(String id)
Set the session identifier for this session.
|
void |
setId(String id,
boolean notify)
Set the session identifier for this session and optionally notifies any
associated listeners that a new session has been created.
|
void |
setLastTimeReplicated(long lastTimeReplicated)
Set the last replicate time.
|
void |
setMaxInactiveInterval(int interval)
Set the maximum time interval, in seconds, between client requests
before the servlet container will invalidate the session.
|
void |
setMaxInactiveInterval(int interval,
boolean addDeltaRequest) |
void |
setNew(boolean isNew)
Set the
isNew flag for this session. |
void |
setNew(boolean isNew,
boolean addDeltaRequest) |
void |
setOwner(Object owner)
This method is called after the object has been
created on a remote map.
|
void |
setPrimarySession(boolean primarySession)
Sets whether this is the primary session or not.
|
void |
setPrincipal(Principal principal)
Set the authenticated Principal that is associated with this Session.
|
void |
setPrincipal(Principal principal,
boolean addDeltaRequest) |
void |
setVersion(long version)
Forces a certain version to a replicated map entry
|
String |
toString()
Return a string representation of this object.
|
void |
unlock()
Unlock after serialization
|
void |
writeExternal(ObjectOutput out) |
void |
writeObjectData(ObjectOutput stream) |
void |
writeObjectData(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, expire, fireSessionEvent, getAttribute, getAttributeNames, getAuthType, getCreationTime, getCreationTimeInternal, getId, getIdInternal, getIdleTime, getIdleTimeInternal, getLastAccessedTime, getLastAccessedTimeInternal, getManager, getMaxInactiveInterval, getNote, getNoteNames, getPrincipal, getServletContext, getSession, getSessionContext, getThisAccessedTime, getThisAccessedTimeInternal, getValue, getValueNames, invalidate, isNew, isValidInternal, keys, passivate, putValue, removeAttribute, removeAttributeInternal, removeNote, removeValue, setAttribute, setCreationTime, setManager, setNote, setValid, tellChangedSessionId, tellNewclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaccess, expire, getAuthType, getCreationTime, getCreationTimeInternal, getId, getIdInternal, getIdleTime, getIdleTimeInternal, getLastAccessedTime, getLastAccessedTimeInternal, getManager, getMaxInactiveInterval, getNote, getNoteNames, getPrincipal, getSession, getThisAccessedTime, getThisAccessedTimeInternal, removeNote, setCreationTime, setManager, setNote, setValid, tellChangedSessionIdgetAttribute, getAttributeNames, getCreationTime, getId, getLastAccessedTime, getMaxInactiveInterval, getServletContext, getSessionContext, getValue, getValueNames, invalidate, isNew, putValue, removeAttribute, removeValuepublic static final Log log
protected static final StringManager sm
protected final Lock diffLock
public DeltaSession()
public DeltaSession(Manager manager)
manager - The manager with which this Session is associatedpublic boolean isDirty()
isDirty in interface ReplicatedMapEntrypublic boolean isDiffable()
isDiffable in interface ReplicatedMapEntrypublic byte[] getDiff()
throws IOException
getDiff in interface ReplicatedMapEntryIOExceptionpublic ClassLoader[] getClassLoaders()
public void applyDiff(byte[] diff,
int offset,
int length)
throws IOException,
ClassNotFoundException
applyDiff in interface ReplicatedMapEntrydiff - byte[]offset - intlength - intIOExceptionClassNotFoundExceptionpublic void resetDiff()
resetDiff in interface ReplicatedMapEntrypublic void lock()
lock in interface ReplicatedMapEntrypublic void unlock()
unlock in interface ReplicatedMapEntrypublic void setOwner(Object owner)
ReplicatedMapEntrysetOwner in interface ReplicatedMapEntryowner - Objectpublic boolean isAccessReplicate()
isAccessReplicate in interface ReplicatedMapEntrypublic void accessEntry()
accessEntry in interface ReplicatedMapEntrypublic boolean isPrimarySession()
isPrimarySession in interface ClusterSessionpublic void setPrimarySession(boolean primarySession)
setPrimarySession in interface ClusterSessionprimarySession - Flag valuepublic void setId(String id, boolean notify)
setId in interface SessionsetId in class StandardSessionid - The new session identifiernotify - Should any associated listeners be notified that a new
session has been created?public void setId(String id)
setId in interface SessionsetId in class StandardSessionid - The new session identifierpublic void setMaxInactiveInterval(int interval)
StandardSessionsetMaxInactiveInterval in interface HttpSessionsetMaxInactiveInterval in interface SessionsetMaxInactiveInterval in class StandardSessioninterval - The new maximum intervalpublic void setMaxInactiveInterval(int interval,
boolean addDeltaRequest)
public void setNew(boolean isNew)
isNew flag for this session.setNew in interface SessionsetNew in class StandardSessionisNew - The new value for the isNew flagpublic void setNew(boolean isNew,
boolean addDeltaRequest)
public void setPrincipal(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 SessionsetPrincipal in class StandardSessionprincipal - The new Principal, or null if nonepublic void setPrincipal(Principal principal, boolean addDeltaRequest)
public void setAuthType(String authType)
setAuthType in interface SessionsetAuthType in class StandardSessionauthType - The new cached authentication typepublic void setAuthType(String authType, boolean addDeltaRequest)
public boolean isValid()
isValid flag for this session.isValid in interface SessionisValid in class StandardSessionpublic void endAccess()
endAccess in interface SessionendAccess in class StandardSessionpublic void expire(boolean notify)
expire in class StandardSessionnotify - Should we notify listeners about the demise of this session?public void expire(boolean notify,
boolean notifyCluster)
public void recycle()
recycle in interface Sessionrecycle in class StandardSessionpublic String toString()
toString in class StandardSessionpublic void addSessionListener(SessionListener listener)
StandardSessionaddSessionListener in interface SessionaddSessionListener in class StandardSessionpublic void addSessionListener(SessionListener listener, boolean addDeltaRequest)
public void removeSessionListener(SessionListener listener)
StandardSessionremoveSessionListener in interface SessionremoveSessionListener in class StandardSessionpublic void removeSessionListener(SessionListener listener, boolean addDeltaRequest)
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic void readObjectData(ObjectInputStream stream) throws ClassNotFoundException, IOException
readObjectData in class StandardSessionstream - The object input stream to read fromClassNotFoundException - if an unknown class is specifiedIOException - if an input/output error occurspublic void readObjectData(ObjectInput stream) throws ClassNotFoundException, IOException
ClassNotFoundExceptionIOExceptionpublic void writeObjectData(ObjectOutputStream stream) throws IOException
writeObjectData in class StandardSessionstream - The object output stream to write toIOException - if an input/output error occurspublic void writeObjectData(ObjectOutput stream) throws IOException
IOExceptionpublic void resetDeltaRequest()
public DeltaRequest getDeltaRequest()
protected boolean isAttributeDistributable(String name, Object value)
isAttributeDistributable in class StandardSessionname - The name of the attribute to checkvalue - The value of the attribute to checkprotected boolean exclude(String name)
exclude in class StandardSessionname - the attribute's namepublic void removeAttribute(String name, boolean notify)
After this method executes, and if the object implements
HttpSessionBindingListener, the container calls
valueUnbound() on the object.
removeAttribute in class StandardSessionname - Name of the object to remove from this session.notify - Should we notify interested listeners that this attribute is
being removed?IllegalStateException - if this method is called on an invalidated sessionpublic void removeAttribute(String name, boolean notify, boolean addDeltaRequest)
public void setAttribute(String name, Object value)
After this method executes, and if the object implements
HttpSessionBindingListener, the container calls
valueBound() on the object.
setAttribute in interface HttpSessionsetAttribute in class StandardSessionname - Name to which the object is bound, cannot be nullvalue - Object to be bound, cannot be nullIllegalArgumentException - if an attempt is made to add a non-serializable object in
an environment marked distributable.IllegalStateException - if this method is called on an invalidated sessionpublic void setAttribute(String name, Object value, boolean notify, boolean addDeltaRequest)
protected void doReadObject(ObjectInputStream stream) throws ClassNotFoundException, IOException
IMPLEMENTATION NOTE : The reference to the owning Manager is not restored by this method, and must be set explicitly.
doReadObject in class StandardSessionstream - The input stream to read fromClassNotFoundException - if an unknown class is specifiedIOException - if an input/output error occurspublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionprotected void doWriteObject(ObjectOutputStream stream) throws IOException
IMPLEMENTATION NOTE : The owning Manager will not be stored in the
serialized representation of this Session. After calling
readObject(), you must set the associated Manager
explicitly.
IMPLEMENTATION NOTE : Any attribute that is not Serializable will
be unbound from the session, with appropriate actions if it implements
HttpSessionBindingListener. If you do not want any such attributes, be
sure the distributable property of the associated Manager
is set to true.
doWriteObject in class StandardSessionstream - The output stream to write toIOException - if an input/output error occursprotected void removeAttributeInternal(String name, boolean notify, boolean addDeltaRequest)
public long getLastTimeReplicated()
ReplicatedMapEntrygetLastTimeReplicated in interface ReplicatedMapEntrypublic long getVersion()
ReplicatedMapEntrygetVersion in interface ReplicatedMapEntrypublic void setLastTimeReplicated(long lastTimeReplicated)
ReplicatedMapEntrysetLastTimeReplicated in interface ReplicatedMapEntrypublic void setVersion(long version)
ReplicatedMapEntrysetVersion in interface ReplicatedMapEntryversion - longprotected void setAccessCount(int count)
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.