public abstract class AbstractHttpSessionModel extends Base implements HttpSessionModel, Externalizable, ExternalizableLite
Note that the Externalizable implementation on this class is just there to throw exceptions that this class is not Serializable or Externalizable. Use ExternalizableLite instead.
Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
static String |
CTX_OPTIMIZE_MODIFIED_SESSIONS
Deprecated.
The configuration property that specifies to use the flush cache optimization for sessions that have been modified.
|
static int |
MAGIC_V350
Deprecated.
Coherence*Web version identifier for serialization.
|
String[] |
STRING_ARRAY
Deprecated.
Zero-length array of String objects.
|
Constructor and Description |
---|
AbstractHttpSessionModel()
Deprecated.
Default constructor for deserialization.
|
AbstractHttpSessionModel(AbstractHttpSessionCollection collection, javax.servlet.http.HttpSession session, String sId)
Deprecated.
Session creation constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
activate(javax.servlet.http.HttpSession session)
Deprecated.
Activate the session model.
|
protected void |
addEnteredThread()
Deprecated.
Add the currently running thread to the list of threads that have entered this session model.
|
protected void |
bind(AttributeHolder holderOld, AttributeHolder holderNew)
Deprecated.
Bind the specified session attribute, replacing the specified attribute if it exists.
|
protected void |
checkActive()
Deprecated.
Make sure that the model is 'active', 'usable' and 'valid'.
|
protected void |
checkUsable()
Deprecated.
Make sure that the model is 'usable'.
|
protected void |
checkValid()
Deprecated.
Make sure that the model is 'usable' and 'valid'.
|
protected void |
discard()
Deprecated.
When the session model is no longer usable, it is discarded.
|
protected void |
enter()
Deprecated.
Increment the usage count of the session by this thread.
|
protected void |
exit()
Deprecated.
Decrement the usage count of the session by this thread.
|
protected String |
extractAttributeName(String sAttribute)
Deprecated.
Given a potentially qualified attribute name, return the original (fully unqualified) attribute name.
|
protected String[] |
extractAttributeNames(String[] asAttribute)
Deprecated.
Given an array of potentially qualified attribute name, return an array of the original (fully unqualified) attribute names.
|
protected void |
flush()
Deprecated.
Flush the changes to this model to whatever data structure (for example, a cache) that is responsible for managing the model's data.
|
protected Map |
getActualAttributeMap()
Deprecated.
Get the map of session attributes that are part of this session (not "local".)
|
Object |
getAttribute(String sName)
Deprecated.
Returns the object bound with the specified name in this session, or
null if no object is bound under the name. |
protected Map |
getAttributeMap()
Deprecated.
Get a view of the session's attributes as a Map.
|
String[] |
getAttributeNameArray()
Deprecated.
Returns an array of attribute names for this session.
|
protected AbstractHttpSessionCollection |
getCollection()
Deprecated.
Determine the collection that this model belongs to.
|
long |
getCreationTime()
Deprecated.
Returns the creation time for this session.
|
protected String |
getDescription()
Deprecated.
Returns a string representation of this object's attributes.
|
protected Set<Thread> |
getEnteredThreads()
Deprecated.
Retrieve the list of all threads that have entered this session model.
|
protected javax.servlet.http.HttpSession |
getHttpSession()
Deprecated.
Determine the HttpSession that this model is bound to.
|
String |
getId()
Deprecated.
Returns the session identifier for this session.
|
long |
getLastAccessedTime()
Deprecated.
Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT.
|
protected long |
getLastFlushedTime()
Deprecated.
Returns the last time this session was flushed, as the number of milliseconds since midnight, January 1, 1970 GMT.
|
protected Map |
getLocalAttributeMap()
Deprecated.
Get the map of session attributes that are owned by this model but are stored in a "local" manner.
|
int |
getMaxInactiveInterval()
Deprecated.
Returns the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session.
|
String |
getNewId()
Deprecated.
Returns the updated session identifier for this session after authentication.
|
int |
getReferenceCount()
Deprecated.
Determine the reference count (unmatched enter calls) for this model.
|
protected Thread |
getThreadOwner()
Deprecated.
Retrieve the thread that has entered this session model.
|
protected int |
getVersion()
Deprecated.
Return the version indicator for this model.
|
protected AttributeHolder |
instantiateAttributeHolder()
Deprecated.
Factory method: Instantiate an AttributeHolder for deserialization purposes.
|
protected AttributeHolder |
instantiateAttributeHolder(String sName, Object oValue)
Deprecated.
Factory method: Instantiate an AttributeHolder to manage the passed value.
|
protected boolean |
isActivatableAttributes()
Deprecated.
Determine if the session model may have attributes that need to be activated and passivated.
|
protected boolean |
isActive()
Deprecated.
Determine if the session model is active (not passivated).
|
boolean |
isExpired()
Deprecated.
A helper method to determine if the session data has expired.
|
protected boolean |
isExpiredInternal(long currentTime)
Deprecated.
Check if the session has expired.
|
static boolean |
isImmutable(Object o)
Deprecated.
Determine if the passed object is definitely of an immutable type.
|
protected boolean |
isLastAccessTimeFlushRequired()
Deprecated.
Determine if the LastAccessTime property (and only that property) needs to be flushed.
|
protected boolean |
isLocal()
Deprecated.
Determine whether the session is local (not distributed).
|
protected boolean |
isModified()
Deprecated.
Determine if the session has been modified since it was deserialized or last marked as not-modified.
|
boolean |
isNew()
Deprecated.
Returns
true if the client does not yet know about the session or if the client chooses not to join the session. |
protected boolean |
isOwnedByThisThread()
Deprecated.
Determine if this model is owned by the current thread.
|
boolean |
isUsable()
Deprecated.
Determine if this session model is a usable object.
|
boolean |
isValid()
Deprecated.
Determine if this session model is valid.
|
protected void |
logAttributeSerializationFailure(AttributeHolder holder, Throwable e)
Deprecated.
Log a serialization failure for an attribute holder.
|
protected boolean |
obtainThreadOwnership()
Deprecated.
Obtain thread ownership of this model, if necessary.
|
protected void |
passivate()
Deprecated.
Passivate the session model.
|
protected String |
qualifyAttributeName(String sAttribute)
Deprecated.
Given an attribute name, return a potentially qualified name.
|
protected void |
readAttributes(DataInput in)
Deprecated.
Helper to read the session attributes from a stream.
|
void |
readExternal(DataInput in)
Deprecated.
Helper to read the object state from a stream.
|
void |
readExternal(ObjectInput in)
Deprecated.
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
|
protected void |
releaseThreadOwnership()
Deprecated.
Release thread ownership of this model.
|
void |
removeAttribute(String sName)
Deprecated.
Removes the object bound with the specified name from this session.
|
protected void |
removeEnteredThread()
Deprecated.
Remove the currently running thread from the list of threads that have entered this session model.
|
void |
sessionReturned()
Deprecated.
Indicates to the session that it is no longer new, because the session ID has been returned to the client to allow the client to accept it, as described in the Servlet specification.
|
protected void |
setActivatableAttributes(boolean fActivatable)
Deprecated.
Specify whether the session model may or may not have attributes that need to be activated and passivated.
|
void |
setAttribute(String sName, Object oValue)
Deprecated.
Binds an object to this session, using the name specified.
|
protected void |
setCollection(AbstractHttpSessionCollection collection)
Deprecated.
After deserialization, the collection needs to be configured.
|
protected void |
setHttpSession(javax.servlet.http.HttpSession session)
Deprecated.
Configure the HttpSession that this model is bound to.
|
protected void |
setId(String sId)
Deprecated.
Allow a sub-class to specify the session ID, for example during deserialization.
|
protected void |
setLastAccessedTime(long ldtLastAccessedTime)
Deprecated.
Set the time this session was last accessed, as the number of milliseconds since midnight, January 1, 1970 GMT.
|
protected void |
setLastFlushedTime(long ldtLastFlushedTime)
Deprecated.
Set the time this session was last flushed, as the number of milliseconds since midnight, January 1, 1970 GMT.
|
void |
setMaxInactiveInterval(int cSeconds)
Deprecated.
Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session.
|
protected void |
setModified(boolean fModified)
Deprecated.
Specify whether or not the session has been modified.
|
protected void |
setNewId(String sNewId)
Deprecated.
Set the updated session id after authentication has occured.
|
protected void |
setValid(boolean fValid)
Deprecated.
Allow a sub-class to explicitly validate the session model, for example at the completion of deserialization.
|
protected void |
setVersion(int nVersion)
Deprecated.
Set the version indicator of this model.
|
String |
toString()
Deprecated.
Returns a string representation of the object.
|
void |
touch()
Deprecated.
Update the last-accessed time for the session.
|
protected void |
unbind()
Deprecated.
Unbind session attributes.
|
protected void |
unbind(AttributeHolder holder, boolean fAll)
Deprecated.
Unbind the specified session attributes name and value.
|
protected void |
writeAttributes(DataOutput out)
Deprecated.
Helper to write the session attributes to a stream.
|
void |
writeExternal(DataOutput out)
Deprecated.
Helper to write the object state to a stream.
|
void |
writeExternal(ObjectOutput out)
Deprecated.
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
|
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
public String[] STRING_ARRAY
public static final int MAGIC_V350
public static final String CTX_OPTIMIZE_MODIFIED_SESSIONS
public AbstractHttpSessionModel()
public AbstractHttpSessionModel(AbstractHttpSessionCollection collection, javax.servlet.http.HttpSession session, String sId)
collection
- the collection that manages this modelsession
- the session that delegates to this modelsId
- the session IDpublic Object getAttribute(String sName)
null
if no object is bound under the name.getAttribute
in interface HttpSessionModel
sName
- a string specifying the name of the objectpublic String[] getAttributeNameArray()
getAttributeNameArray
in interface HttpSessionModel
String
objects specifying the names of all the objects bound to this sessionpublic long getCreationTime()
getCreationTime
in interface HttpSessionModel
public String getId()
getId
in interface HttpSessionModel
public String getNewId()
public long getLastAccessedTime()
getLastAccessedTime
in interface HttpSessionModel
public int getMaxInactiveInterval()
getMaxInactiveInterval
in interface HttpSessionModel
public boolean isExpired()
isExpired
in interface HttpSessionModel
protected boolean isExpiredInternal(long currentTime)
currentTime
- the current time in millispublic boolean isNew()
true
if the client does not yet know about the session or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client had disabled the use of cookies, then a session would be new on each request.isNew
in interface HttpSessionModel
true
if the server has created a session, but the client has not yet joinedpublic boolean isUsable()
When a session model becomes unusable, the only method that can be assumed to respond without throwing an exception is HttpSessionModel.getId()
.
isUsable
in interface HttpSessionModel
public boolean isValid()
isValid
in interface HttpSessionModel
true
if the session has not been destroyed, otherwise false
public void removeAttribute(String sName)
removeAttribute
in interface HttpSessionModel
sName
- the name of the object to remove from this sessionpublic void sessionReturned()
sessionReturned
in interface HttpSessionModel
public void setAttribute(String sName, Object oValue)
setAttribute
in interface HttpSessionModel
sName
- the name to which the object is bound; cannot be nulloValue
- the object to be bound; cannot be nullpublic void setMaxInactiveInterval(int cSeconds)
setMaxInactiveInterval
in interface HttpSessionModel
cSeconds
- the new maximum intervalpublic void touch()
touch
in interface HttpSessionModel
public String toString()
protected AbstractHttpSessionCollection getCollection()
protected void setCollection(AbstractHttpSessionCollection collection)
collection
- the AbstractHttpSessionCollection that this model belongs toprotected javax.servlet.http.HttpSession getHttpSession()
protected void setHttpSession(javax.servlet.http.HttpSession session)
session
- the HttpSession that this model is bound to; may be null to deactivate the modelprotected void setId(String sId)
sId
- the session idprotected void setNewId(String sNewId)
sNewId
- the new session idprotected void setValid(boolean fValid)
fValid
- true if the session model is valid, false otherwiseprotected int getVersion()
The version indicator is used to detect concurrent modifications when member-level locking is disabled.
protected void setVersion(int nVersion)
nVersion
- the new version indicator; must be >= 0protected boolean isLocal()
protected Map getAttributeMap()
protected Map getActualAttributeMap()
protected Map getLocalAttributeMap()
protected boolean isActive()
protected boolean isActivatableAttributes()
protected void setActivatableAttributes(boolean fActivatable)
fActivatable
- passtrue if any of the session attributes may require activationprotected void activate(javax.servlet.http.HttpSession session)
This method may only be called by a thread that owns this model. See AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.
session
- the HttpSession to bind this model toprotected void passivate()
This method may only be called by a thread that owns this model. See AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.
protected void bind(AttributeHolder holderOld, AttributeHolder holderNew)
This method may only be called by a thread that owns this model. See AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.
holderOld
- the attribute information to unbind; may be nullholderNew
- the attribute information to bindprotected void unbind(AttributeHolder holder, boolean fAll)
This method may only be called by a thread that owns this model. See AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.
holder
- the attribute information to unbindfAll
- true if this method is called within the context of an unbind()
callprotected void unbind()
This method may only be called by a thread that owns this model. See AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.
protected void logAttributeSerializationFailure(AttributeHolder holder, Throwable e)
holder
- the attribute holder that failed to serialize its valuee
- the throwable object that resulted from the serialization failureprotected void discard()
This method may only be called by a thread that owns this model. See AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.
protected boolean isModified()
protected void setModified(boolean fModified)
fModified
- true if the session has been modified, false to reset the modified indicatorprotected void setLastAccessedTime(long ldtLastAccessedTime)
ldtLastAccessedTime
- the last time this session was accessed, as the number of milliseconds since midnight, January 1, 1970 GMTprotected long getLastFlushedTime()
protected void setLastFlushedTime(long ldtLastFlushedTime)
ldtLastFlushedTime
- the last time this session was flushed, as the number of milliseconds since midnight, January 1, 1970 GMTprotected boolean isLastAccessTimeFlushRequired()
protected Set<Thread> getEnteredThreads()
protected void addEnteredThread()
protected void removeEnteredThread()
protected Thread getThreadOwner()
protected boolean obtainThreadOwnership()
If thread locking is enforced this method has no effect and false is returned; otherwise, this model is locked in the local owned cache and true is returned. A return value of true implies that releaseThreadOwnership()
must be called when exclusive access to the model is no longer required.
AbstractHttpSessionCollection.obtainThreadOwnership(String)
protected void releaseThreadOwnership()
protected boolean isOwnedByThisThread()
public int getReferenceCount()
getReferenceCount
in interface HttpSessionModel
protected void enter()
This method may only be called by a thread that owns this model. See AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.
protected void exit()
This method may only be called by a thread that owns this model. See AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.
protected void flush()
This method may only be called by a thread that owns this model. See AbstractHttpSessionCollection.obtainThreadOwnership(java.lang.String)
.
public void readExternal(ObjectInput in) throws IOException
readExternal
in interface Externalizable
in
- the stream to read data from in order to restore the objectIOException
- if an I/O exception occurspublic void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- the stream to write the object toIOException
- if an I/O exception occurspublic void readExternal(DataInput in) throws IOException
readExternal
in interface ExternalizableLite
in
- the stream to read data from in order to restore the objectIOException
- if an I/O exception occurspublic void writeExternal(DataOutput out) throws IOException
writeExternal
in interface ExternalizableLite
out
- the stream to write the object toIOException
- if an I/O exception occursprotected void readAttributes(DataInput in) throws IOException
in
- the stream to read data from in order to restore the objectIOException
- if an I/O exception occursprotected void writeAttributes(DataOutput out) throws IOException
out
- the stream to write the object toIOException
- if an I/O exception occursprotected String getDescription()
protected void checkActive()
IllegalStateException
- if the model is not 'active', 'usable' and 'valid'protected void checkValid()
IllegalStateException
- if the model is not both 'usable' and 'valid'protected void checkUsable()
IllegalStateException
- if the model is not 'usable'protected String qualifyAttributeName(String sAttribute)
sAttribute
- the name that the application identifies the attribute byprotected String extractAttributeName(String sAttribute)
sAttribute
- an attribute name that may be qualifiedprotected String[] extractAttributeNames(String[] asAttribute)
asAttribute
- an array of attribute names that may be qualifiedprotected AttributeHolder instantiateAttributeHolder()
protected AttributeHolder instantiateAttributeHolder(String sName, Object oValue)
sName
- the attribute nameoValue
- a non-null Object valuepublic static boolean isImmutable(Object o)
o
- an object to check for immutability