|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mobicents.servlet.sip.core.session.SipSessionImpl
org.jboss.web.tomcat.service.session.ClusteredSipSession
public abstract class ClusteredSipSession
Abstract base class for sip session clustering based on SipSessionImpl. Different session replication strategy can be implemented such as session- field- or attribute-based ones.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.mobicents.servlet.sip.core.session.SipSessionImpl |
|---|
SipSessionImpl.SipSessionEventType |
| Nested classes/interfaces inherited from interface javax.servlet.sip.SipSession |
|---|
SipSession.State |
| Field Summary | |
|---|---|
protected static java.lang.String[] |
excludedAttributes
Set of attribute names which are not allowed to be replicated/persisted. |
protected boolean |
firstAccess
Has this session only been accessed once? |
protected java.lang.Boolean |
hasActivationListener
Whether any of this session's attributes implement HttpSessionActivationListener. |
protected static java.lang.String |
info
Descriptive information describing this Session implementation. |
protected int |
invalidationPolicy
|
protected boolean |
isSessionModifiedSinceLastSave
Deprecated. not used |
protected long |
lastReplicated
Timestamp when we were last replicated. |
protected int |
maxUnreplicatedFactor
Maximum percentage of the inactive interval this session should be allowed to go unreplicated if access to the session doesn't mark it as dirty. |
protected long |
maxUnreplicatedInterval
Maximum number of milliseconds this session should be allowed to go unreplicated if access to the session doesn't mark it as dirty. |
protected long |
outdatedTime
The last time setIsOutdated(true) was called or
0 if setIsOutdated(false) was subsequently
called. |
protected int |
outdatedVersion
The last version that was passed to setOutdatedVersion(int) or
0 if setIsOutdated(false) was subsequently
called. |
protected static java.util.Set |
replicationExcludes
Set containing all members of excludedAttributes. |
protected boolean |
sessionAttributesDirty
If true, means the local in-memory session data contains attribute changes that have not been published to the distributed cache. |
protected boolean |
sessionMetadataDirty
If true, means the local in-memory session data contains metadata changes that have not been published to the distributed cache. |
protected SipApplicationSessionKey |
sipAppSessionParentKey
|
protected static org.apache.catalina.util.StringManager |
sm
The string manager for this package. |
protected int |
version
Version number to track cache invalidation. |
| Fields inherited from class org.mobicents.servlet.sip.core.session.SipSessionImpl |
|---|
creationTime, derivedSipSessions, handlerServlet, invalidateWhenReady, isValid, key, lastAccessedTime, ongoingTransactions, outboundInterface, parentSession, proxyBranch, readyToInvalidate, routingRegion, sessionCreatingDialog, sessionCreatingTransaction, sipApplicationSession, sipFactory, sipSessionAttributeMap, state, stateInfo, subscriberURI, supervisedMode, userPrincipal |
| Constructor Summary | |
|---|---|
protected |
ClusteredSipSession(SipSessionKey key,
SipFactoryImpl sipFactoryImpl,
MobicentsSipApplicationSession mobicentsSipApplicationSession,
boolean useJK)
|
| Method Summary | |
|---|---|
void |
access()
Update the accessed time information for this session. |
void |
activate()
Perform internal processing required to activate this session. |
protected boolean |
canAttributeBeReplicated(java.lang.Object attribute)
Returns whether the attribute's type is one that can be replicated. |
void |
clearOutdated()
|
void |
expire(boolean notify)
Expires the session, but in such a way that other cluster nodes are unaware of the expiration. |
void |
expire(boolean notify,
boolean localCall,
boolean localOnly)
Expires the session, notifying listeners and possibly the manager. |
java.lang.Object |
getAttribute(java.lang.String name)
|
protected java.lang.Object |
getAttributeInternal(java.lang.String name)
|
java.util.Enumeration |
getAttributeNames()
|
protected java.util.Map |
getAttributesInternal()
|
boolean |
getExceedsMaxUnreplicatedInterval()
|
protected abstract java.lang.Object |
getJBossInternalAttribute(java.lang.String name)
|
protected abstract java.util.Map |
getJBossInternalAttributes()
|
long |
getLastReplicated()
Gets the time updateLastReplicated() was last called, or
0 if it has never been called. |
int |
getMaxUnreplicatedFactor()
Gets the maximum percentage of the maxInactiveInterval
beyond which a session should be replicated upon access even if it isn't
dirty. |
long |
getMaxUnreplicatedInterval()
|
boolean |
getReplicateSessionBody()
|
protected boolean |
getSessionAttributesDirty()
|
protected boolean |
getSessionMetadataDirty()
|
boolean |
getUseJK()
This is called specifically for failover case using mod_jk where the new session has this node name in there. |
int |
getVersion()
|
int |
incrementVersion()
There are couple ways to generate this version number. |
abstract void |
initAfterLoad(JBossCacheSipManager manager)
This is called after loading a session to initialize the transient values. |
protected boolean |
isGetDirty(java.lang.Object attribute)
|
protected boolean |
isMutable(java.lang.Object attribute)
|
boolean |
isNewData(int version)
Check to see if the input version number is greater than I am. |
boolean |
isOutdated()
Check to see if the session data is still valid. |
boolean |
isSessionDirty()
|
boolean |
isValid()
Overrides the superclass method to call @
#isValid(boolean) isValid(true)} . |
boolean |
isValid(boolean expireIfInvalid)
Returns whether the current session is still valid, but only calls expire(boolean) for timed-out sessions if
expireIfInvalid is true. |
protected java.lang.String[] |
keys()
Method inherited from Tomcat. |
void |
passivate()
Perform the internal processing required to passivate this session. |
abstract void |
processSessionRepl()
Propogate session to the internal store. |
void |
readExternal(java.io.ObjectInput in)
Reads all non-transient state from the ObjectOutput except the attribute map. |
protected void |
removeAttributeInternal(java.lang.String name,
boolean notify)
Called by super.removeAttribute(). |
protected java.lang.Object |
removeAttributeInternal(java.lang.String name,
boolean localCall,
boolean localOnly)
Deprecated. will be replaced by removeJBossInternalAttribute(String, boolean, boolean) |
protected void |
removeAttributeInternal(java.lang.String name,
boolean localCall,
boolean localOnly,
boolean notify)
Remove the attribute from the local cache and possibly the distributed cache, plus notify any listeners |
protected static java.util.Map |
removeExcludedAttributes(java.util.Map attributes)
Removes any attribute whose name is found in excludedAttributes
from attributes and returns a Map of all such attributes. |
protected void |
removeFromManager(boolean localCall,
boolean localOnly)
Advise our manager to remove this expired session. |
protected abstract java.lang.Object |
removeJBossInternalAttribute(java.lang.String name)
Deprecated. will be replaced by removeJBossInternalAttribute(String, boolean, boolean) |
abstract void |
removeMyself()
Remove myself from the internal store. |
abstract void |
removeMyselfLocal()
Remove myself from the |
protected void |
sessionAttributesDirty()
|
protected void |
sessionDirty()
Deprecated. use one of the more fine-grained methods. |
protected void |
sessionMetadataDirty()
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
|
protected java.lang.Object |
setInternalAttribute(java.lang.String name,
java.lang.Object value)
|
void |
setIsOutdated(boolean outdated)
Deprecated. use setOutdatedVersion(int) and
clearOutdated() |
protected abstract java.lang.Object |
setJBossInternalAttribute(java.lang.String name,
java.lang.Object value)
|
void |
setMaxUnreplicatedFactor(int factor)
Sets the maximum percentage of the maxInactiveInterval
beyond which a session should be replicated upon access even if it isn't
dirty. |
void |
setOutdatedVersion(int version)
|
void |
setPrincipal(java.security.Principal principal)
Set the authenticated Principal that is associated with this Session. |
void |
setVersion(int version)
|
java.lang.String |
toString()
|
void |
updateAccessTimeFromOutdatedTime()
|
void |
updateLastReplicated()
Sets the lastReplicated field to the current
time. |
void |
writeExternal(java.io.ObjectOutput out)
Writes all non-transient state to the ObjectOutput except the attribute map. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String info
protected static final java.lang.String[] excludedAttributes
protected static final java.util.Set replicationExcludes
excludedAttributes.
protected int invalidationPolicy
protected transient boolean isSessionModifiedSinceLastSave
protected transient boolean sessionMetadataDirty
protected transient boolean sessionAttributesDirty
protected transient int outdatedVersion
setOutdatedVersion(int) or
0 if setIsOutdated(false) was subsequently
called.
protected transient long outdatedTime
setIsOutdated(true) was called or
0 if setIsOutdated(false) was subsequently
called.
protected int version
protected transient long lastReplicated
protected transient int maxUnreplicatedFactor
protected transient long maxUnreplicatedInterval
protected transient java.lang.Boolean hasActivationListener
protected transient boolean firstAccess
protected transient SipApplicationSessionKey sipAppSessionParentKey
protected static org.apache.catalina.util.StringManager sm
| Constructor Detail |
|---|
protected ClusteredSipSession(SipSessionKey key,
SipFactoryImpl sipFactoryImpl,
MobicentsSipApplicationSession mobicentsSipApplicationSession,
boolean useJK)
| Method Detail |
|---|
public boolean isOutdated()
public void setIsOutdated(boolean outdated)
setOutdatedVersion(int) and
clearOutdated()
outdated - public void setOutdatedVersion(int version)
public void clearOutdated()
public void updateAccessTimeFromOutdatedTime()
public boolean getUseJK()
id - public boolean isNewData(int version)
version -
public int getVersion()
public void setVersion(int version)
public int incrementVersion()
public int getMaxUnreplicatedFactor()
maxInactiveInterval
beyond which a session should be replicated upon access even if it isn't
dirty. Used to ensure that even a read-only session gets replicated
before it expires, so that it isn't removed from other nodes.
public void setMaxUnreplicatedFactor(int factor)
maxInactiveInterval
beyond which a session should be replicated upon access even if it isn't
dirty. Used to ensure that even a read-only session gets replicated
before it expires, so that it isn't removed from other nodes.
maxUnreplicatedFactor - an int between 1 and 100, or -1 to disable replicating on
access
java.lang.IllegalArgumentException - if the factor isn't -1 or between 1 and 100public long getLastReplicated()
updateLastReplicated() was last called, or
0 if it has never been called.
public void updateLastReplicated()
lastReplicated field to the current
time.
public long getMaxUnreplicatedInterval()
public boolean getExceedsMaxUnreplicatedInterval()
public abstract void initAfterLoad(JBossCacheSipManager manager)
manager - public abstract void processSessionRepl()
public abstract void removeMyself()
public abstract void removeMyselfLocal()
public void access()
SipSessionImpl
access in interface MobicentsSipSessionaccess in class SipSessionImplpublic java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface SipSessiongetAttribute in class SipSessionImplpublic java.util.Enumeration getAttributeNames()
getAttributeNames in interface SipSessiongetAttributeNames in class SipSessionImpl
public void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface SipSessionsetAttribute in class SipSessionImplprotected boolean canAttributeBeReplicated(java.lang.Object attribute)
attribute - the attribute
true if attribute is null,
Serializable or an array of primitives.public boolean isValid()
superclass method to call @
#isValid(boolean) isValid(true)} .
isValid in interface SipSessionisValid in class SipSessionImplpublic boolean isValid(boolean expireIfInvalid)
expire(boolean) for timed-out sessions if
expireIfInvalid is true.
expireIfInvalid - true if sessions that have been timed out should
be expiredpublic void expire(boolean notify)
notify -
public void expire(boolean notify,
boolean localCall,
boolean localOnly)
NOTE: The manager will only be notified of the
expiration if localCall is true; otherwise it
is the responsibility of the caller to notify the manager that the
session is expired. (In the case of JBossCacheManager, it is the manager
itself that makes such a call, so it of course is aware).
notify - whether servlet spec listeners should be notifiedlocalCall - true if this call originated due to local
activity (such as a session invalidation in user code or an
expiration by the local background processing thread);
false if the expiration originated due to some
kind of event notification from the cluster.localOnly - true if the expiration should not be announced to
the cluster, false if other cluster nodes should
be made aware of the expiration. Only meaningful if
localCall is true.
protected void removeFromManager(boolean localCall,
boolean localOnly)
localCall - whether this call originated from local activity or from a
remote invalidation. In this default implementation, this
parameter is ignored.localOnly - whether the rest of the cluster should be made aware of the
removalpublic void passivate()
SipSessionImpl
passivate in class SipSessionImplpublic void activate()
SipSessionImpl
activate in class SipSessionImplpublic 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.
principal - The new Principal, or null if nonepublic java.lang.String toString()
toString in class java.lang.Object
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
writeExternal().
This method is deliberately public so it can be used to reset the internal state of a session object using serialized contents replicated from another JVM via JBossCache.
readExternal in interface java.io.Externalizablejava.io.IOException
java.lang.ClassNotFoundExceptionExternalizable.readExternal(java.io.ObjectInput)
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionExternalizable.writeExternal(java.io.ObjectOutput)protected static java.util.Map removeExcludedAttributes(java.util.Map attributes)
excludedAttributes
from attributes and returns a Map of all such attributes.
attributes - source map from which excluded attributes are to be removed.
attributes, or null if no attributes
were removed.protected java.lang.String[] keys()
protected void removeAttributeInternal(java.lang.String name,
boolean notify)
name - the attribute namenotify - true if listeners should be notified
protected void removeAttributeInternal(java.lang.String name,
boolean localCall,
boolean localOnly,
boolean notify)
name - the attribute namelocalCall - true if this call originated from local activity
(e.g. a removeAttribute() in the webapp or a local session
invalidation/expiration), false if it originated
due to an remote event in the distributed cache.localOnly - true if the removal should not be replicated
around the clusternotify - true if listeners should be notified
protected java.lang.Object removeAttributeInternal(java.lang.String name,
boolean localCall,
boolean localOnly)
removeJBossInternalAttribute(String).
JBossCacheClusteredSession subclasses will override this to call their
own methods that make use of localCall and localOnly
name - localCall - localOnly -
protected java.lang.Object getAttributeInternal(java.lang.String name)
protected java.util.Map getAttributesInternal()
protected java.lang.Object setInternalAttribute(java.lang.String name,
java.lang.Object value)
protected abstract java.lang.Object getJBossInternalAttribute(java.lang.String name)
protected abstract java.lang.Object removeJBossInternalAttribute(java.lang.String name)
protected abstract java.util.Map getJBossInternalAttributes()
protected abstract java.lang.Object setJBossInternalAttribute(java.lang.String name,
java.lang.Object value)
protected void sessionAttributesDirty()
protected boolean getSessionAttributesDirty()
protected void sessionMetadataDirty()
protected boolean getSessionMetadataDirty()
protected void sessionDirty()
sessionAttributesDirty() and
sessionMetadataDirty().
public boolean isSessionDirty()
public boolean getReplicateSessionBody()
protected boolean isGetDirty(java.lang.Object attribute)
protected boolean isMutable(java.lang.Object attribute)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||