|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.catalina.session.ManagerBase
org.apache.catalina.cluster.session.DeltaManager
The DeltaManager manages replicated sessions by only
replicating the deltas in data. For applications written
to handle this, the DeltaManager is the optimal way of replicating data.
This code is almost identical to StandardManager with a difference in
how it persists sessions and some modifications to it.
IMPLEMENTATION NOTE: Correct behavior of session storing and
reloading depends upon external calls to the start()
and
stop()
methods of this class at the correct times.
Field Summary | |
protected LifecycleSupport |
lifecycle
The lifecycle event support for this component. |
static org.apache.commons.logging.Log |
log
|
protected static java.lang.String |
managerName
The descriptive name of this Manager implementation (for logging). |
protected java.lang.String |
name
|
Fields inherited from class org.apache.catalina.session.ManagerBase |
algorithm, container, DEFAULT_ALGORITHM, devRandomSource, digest, distributable, domain, duplicates, entropy, initialized, maxActive, maxInactiveInterval, mserver, oname, processExpiresFrequency, random, randomClass, randomIS, sessionAverageAliveTime, sessionCounter, sessionIdLength, sessionMaxAliveTime, sessions, sm, support |
Fields inherited from interface org.apache.catalina.Lifecycle |
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
Constructor Summary | |
DeltaManager()
|
Method Summary | |
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component. |
Session |
createSession()
Construct and return a new session object, based on the default settings specified by this Manager's properties. |
Session |
createSession(boolean distribute)
create new session with check maxActiveSessions and send session creation to other cluster nodes. |
LifecycleListener[] |
findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. |
CatalinaCluster |
getCluster()
|
boolean |
getExpireSessionsOnShutdown()
|
java.lang.String |
getInfo()
Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version> . |
java.lang.String[] |
getInvalidatedSessions()
When the manager expires session not tied to a request. |
int |
getMaxActiveSessions()
Return the maximum number of active Sessions allowed, or -1 for no limit. |
java.lang.String |
getName()
Return the descriptive short name of this Manager implementation. |
protected DeltaSession |
getNewDeltaSession()
Get new session class to be used in the doLoad() method. |
boolean |
getNotifyListenersOnReplication()
|
boolean |
getPrintToScreen()
|
int |
getRejectedSessions()
Number of session creations that failed due to maxActiveSessions |
boolean |
getStateTransferred()
|
boolean |
getUseDirtyFlag()
|
void |
load()
Load any currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any. |
void |
messageDataReceived(ClusterMessage cmsg)
A message was received from another node, this is the callback method to implement if you are interested in receiving replication messages. |
protected void |
messageReceived(SessionMessage msg,
Member sender)
This method is called by the received thread when a SessionMessage has been received from one of the other nodes in the cluster. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
Process property change events from our associated Context. |
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component. |
ClusterMessage |
requestCompleted(java.lang.String sessionId)
When the request has been completed, the replication valve will notify the manager, and the manager will decide whether any replication is needed or not. |
protected void |
sessionExpired(java.lang.String id)
send session expired to other cluster nodes |
void |
setCluster(CatalinaCluster cluster)
|
void |
setContainer(Container container)
Set the Container with which this Manager has been associated. |
void |
setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)
|
void |
setMaxActiveSessions(int max)
Set the maximum number of actives Sessions allowed, or -1 for no limit. |
void |
setName(java.lang.String name)
|
void |
setNotifyListenersOnReplication(boolean notifyListenersOnReplication)
|
void |
setPrintToScreen(boolean printToScreen)
|
void |
setRejectedSessions(int rejectedSessions)
Sets the number of sessions that were not created because the maximum number of active sessions was reached. |
void |
setStateTransferred(boolean stateTransferred)
|
void |
setUseDirtyFlag(boolean useDirtyFlag)
|
void |
start()
Prepare for the beginning of active use of the public methods of this component. |
void |
stop()
Gracefully terminate the active use of the public methods of this component. |
void |
unload()
Save any currently active sessions in the appropriate persistence mechanism, if any. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static org.apache.commons.logging.Log log
protected LifecycleSupport lifecycle
protected static java.lang.String managerName
protected java.lang.String name
Constructor Detail |
public DeltaManager()
Method Detail |
public void setContainer(Container container)
setContainer
in interface Manager
setContainer
in class ManagerBase
container
- The associated Containerpublic java.lang.String getInfo()
<description>/<version>
.
getInfo
in interface Manager
getInfo
in class ManagerBase
public int getMaxActiveSessions()
public int getRejectedSessions()
getRejectedSessions
in interface Manager
public void setRejectedSessions(int rejectedSessions)
Manager
setRejectedSessions
in interface Manager
rejectedSessions
- Number of rejected sessionspublic void setMaxActiveSessions(int max)
max
- The new maximum number of sessionspublic java.lang.String getName()
getName
in interface ClusterManager
getName
in class ManagerBase
public Session createSession()
null
.
createSession
in interface Manager
createSession
in class ManagerBase
java.lang.IllegalStateException
- if a new session cannot be
instantiated for any reason
Construct and return a new session object, based on the default
settings specified by this Manager's properties. The session
id will be assigned by this method, and available via the getId()
method of the returned session. If a new session cannot be created
for any reason, return null
.
java.lang.IllegalStateException
- if a new session cannot be
instantiated for any reasonpublic Session createSession(boolean distribute)
distribute
-
protected DeltaSession getNewDeltaSession()
public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic LifecycleListener[] findLifecycleListeners()
findLifecycleListeners
in interface Lifecycle
public void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener
in interface Lifecycle
listener
- The listener to removepublic void start() throws LifecycleException
configure()
,
and before any of the public methods of the component are utilized.
start
in interface Lifecycle
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedpublic void stop() throws LifecycleException
stop
in interface Lifecycle
LifecycleException
- if this component detects a fatal error
that needs to be reportedpublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- The property change event that has occurredpublic void messageDataReceived(ClusterMessage cmsg)
messageDataReceived
in interface ClusterManager
cmsg
- - the message received.public ClusterMessage requestCompleted(java.lang.String sessionId)
requestCompleted
in interface ClusterManager
sessionId
- - the sessionId that just completed.
protected void sessionExpired(java.lang.String id)
id
- session idpublic java.lang.String[] getInvalidatedSessions()
getInvalidatedSessions
in interface ClusterManager
protected void messageReceived(SessionMessage msg, Member sender)
msg
- - the message receivedsender
- - the sender of the message, this is used if we receive a
EVT_GET_ALL_SESSION message, so that we only reply to
the requesting nodepublic boolean getStateTransferred()
public void setStateTransferred(boolean stateTransferred)
public CatalinaCluster getCluster()
public void setCluster(CatalinaCluster cluster)
setCluster
in interface ClusterManager
public void load()
Manager
load
in interface Manager
public void unload()
Manager
unload
in interface Manager
public boolean getUseDirtyFlag()
public void setUseDirtyFlag(boolean useDirtyFlag)
setUseDirtyFlag
in interface ClusterManager
public boolean getExpireSessionsOnShutdown()
public void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)
setExpireSessionsOnShutdown
in interface ClusterManager
public boolean getPrintToScreen()
public void setPrintToScreen(boolean printToScreen)
public void setName(java.lang.String name)
setName
in interface ClusterManager
public boolean getNotifyListenersOnReplication()
getNotifyListenersOnReplication
in interface ClusterManager
public void setNotifyListenersOnReplication(boolean notifyListenersOnReplication)
setNotifyListenersOnReplication
in interface ClusterManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |