org.apache.catalina.ha.session
public class DeltaManager extends ClusterManagerBase
start()
and
stop()
methods of this class at the correct times.
Version: $Revision: 832112 $ $Date: 2009-11-02 22:34:46 +0100 (Mon, 02 Nov 2009) $
Field Summary | |
---|---|
protected boolean | defaultMode |
protected LifecycleSupport | lifecycle
The lifecycle event support for this component. |
static Log | log |
protected static String | managerName
The descriptive name of this Manager implementation (for logging). |
protected String | name |
protected static StringManager | sm
The string manager for this package. |
Constructor Summary | |
---|---|
DeltaManager() |
Method Summary | |
---|---|
void | addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
|
protected boolean | checkSenderDomain(SessionMessage msg, Member sender)
Test that sender and local domain is the same |
ClusterManager | cloneFromTemplate() |
Session | createEmptySession()
Create DeltaSession |
Session | createSession(String sessionId)
Construct and return a new session object, based on the default settings
specified by this Manager's properties. |
Session | createSession(String sessionId, boolean distribute)
create new session with check maxActiveSessions and send session creation
to other cluster nodes.
|
protected DeltaRequest | deserializeDeltaRequest(DeltaSession session, byte[] data)
Load Deltarequest from external node
Load the Class at container classloader |
protected void | deserializeSessions(byte[] data)
Load sessions from other cluster node.
|
boolean | doDomainReplication() |
void | expireAllLocalSessions()
Exipre all find sessions. |
LifecycleListener[] | findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. |
protected Member | findSessionMasterMember()
Find the master of the session state |
void | getAllClusterSessions()
get from first session master the backup from all clustered sessions |
CatalinaCluster | getCluster() |
int | getCounterNoStateTransfered() |
long | getCounterReceive_EVT_ALL_SESSION_DATA() |
int | getCounterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE() |
long | getCounterReceive_EVT_GET_ALL_SESSIONS() |
long | getCounterReceive_EVT_SESSION_ACCESSED() |
long | getCounterReceive_EVT_SESSION_CREATED() |
long | getCounterReceive_EVT_SESSION_DELTA() |
long | getCounterReceive_EVT_SESSION_EXPIRED() |
long | getCounterSend_EVT_ALL_SESSION_DATA() |
int | getCounterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE() |
long | getCounterSend_EVT_GET_ALL_SESSIONS() |
long | getCounterSend_EVT_SESSION_ACCESSED() |
long | getCounterSend_EVT_SESSION_CREATED() |
long | getCounterSend_EVT_SESSION_DELTA() |
long | getCounterSend_EVT_SESSION_EXPIRED() |
String | getInfo()
Return descriptive information about this Manager implementation and the
corresponding version number, in the format
<description>/<version> . |
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. |
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. |
long | getProcessingTime() |
int | getReceivedQueueSize() |
int | getRejectedSessions()
Number of session creations that failed due to maxActiveSessions
|
int | getSendAllSessionsSize() |
int | getSendAllSessionsWaitTime() |
long | getSessionReplaceCounter() |
boolean | getStateTransfered()
is session state transfered complete?
|
int | getStateTransferTimeout() |
protected void | handleALL_SESSION_DATA(SessionMessage msg, Member sender)
handle receive sessions from other not ( restart ) |
protected void | handleALL_SESSION_TRANSFERCOMPLETE(SessionMessage msg, Member sender)
handle receive session state is complete transfered |
protected void | handleGET_ALL_SESSIONS(SessionMessage msg, Member sender)
handle receive that other node want all sessions ( restart )
a) send all sessions with one message
b) send session at blocks
After sending send state is complete transfered |
protected void | handleSESSION_ACCESSED(SessionMessage msg, Member sender)
handle receive session is access at other node ( primary session is now false) |
protected void | handleSESSION_CREATED(SessionMessage msg, Member sender)
handle receive new session is created at other node (create backup - primary false) |
protected void | handleSESSION_DELTA(SessionMessage msg, Member sender)
handle receive session delta |
protected void | handleSESSION_EXPIRED(SessionMessage msg, Member sender)
handle receive session is expire at other node ( expire session also here) |
boolean | isDefaultMode() |
boolean | isExpireSessionsOnShutdown() |
boolean | isNotifyListenersOnReplication() |
boolean | isNotifySessionListenersOnReplication() |
boolean | isSendAllSessions() |
boolean | isStateTimestampDrop() |
void | load() |
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(PropertyChangeEvent event)
Process property change events from our associated Context.
|
protected void | registerSessionAtReplicationValve(DeltaSession session)
Register cross context session at replication valve thread local |
void | removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
|
ClusterMessage | requestCompleted(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. |
ClusterMessage | requestCompleted(String sessionId, boolean expires)
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. |
void | resetStatistics()
Reset manager statistics |
protected void | send(SessionMessage msg)
Send messages to other backup member (domain or all) |
protected void | sendCreateSession(String sessionId, DeltaSession session)
Send create session evt to all backup node |
protected void | sendSessions(Member sender, Session[] currentSessions, long sendTimestamp)
send a block of session to sender |
protected byte[] | serializeDeltaRequest(DeltaSession session, DeltaRequest deltaRequest)
serialize DeltaRequest |
protected byte[] | serializeSessions(Session[] currentSessions)
Save any currently active sessions in the appropriate persistence
mechanism, if any. |
protected void | sessionExpired(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 | setDefaultMode(boolean defaultMode) |
void | setDomainReplication(boolean sendClusterDomainOnly) |
void | setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown) |
void | setMaxActiveSessions(int max)
Set the maximum number of actives Sessions allowed, or -1 for no limit.
|
void | setName(String name) |
void | setNotifyListenersOnReplication(boolean notifyListenersOnReplication) |
void | setNotifySessionListenersOnReplication(boolean notifyListenersCreateSessionOnReplication) |
void | setRejectedSessions(int rejectedSessions) |
void | setSendAllSessions(boolean sendAllSessions) |
void | setSendAllSessionsSize(int sendAllSessionsSize) |
void | setSendAllSessionsWaitTime(int sendAllSessionsWaitTime) |
void | setStateTimestampDrop(boolean isTimestampDrop) |
void | setStateTransfered(boolean stateTransfered)
set that state ist complete transfered |
void | setStateTransferTimeout(int timeoutAllSession) |
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() |
protected void | waitForSendAllSessions(long beforeSendTime)
Wait that cluster session state is transfer or timeout after 60 Sec
With stateTransferTimeout == -1 wait that backup is transfered (forever mode) |
Parameters: listener The listener to add
See Also: createEmptySession
null
.
Throws: 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
.
IllegalStateException
if a new session cannot be instantiated for any reason
Parameters: distribute
Returns: The session
Parameters: session data message data
Returns: The request
Throws: ClassNotFoundException IOException
See Also: readExternal
Throws: ClassNotFoundException if a serialized class cannot be found during the reload IOException if an input/output error occurs
Returns: Returns the sendClusterDomainOnly.
Returns: master member of sessions
See Also: findSessionMasterMember
Returns: Returns the counterNoStateTransfered.
Returns: Returns the counterReceive_EVT_ALL_SESSION_DATA.
Returns: Returns the counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE.
Returns: Returns the counterReceive_EVT_GET_ALL_SESSIONS.
Returns: Returns the counterReceive_EVT_SESSION_ACCESSED.
Returns: Returns the counterReceive_EVT_SESSION_CREATED.
Returns: Returns the counterReceive_EVT_SESSION_DELTA.
Returns: Returns the counterReceive_EVT_SESSION_EXPIRED.
Returns: Returns the counterSend_EVT_ALL_SESSION_DATA.
Returns: Returns the counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE.
Returns: Returns the counterSend_EVT_GET_ALL_SESSIONS.
Returns: Returns the counterSend_EVT_SESSION_ACCESSED.
Returns: Returns the counterSend_EVT_SESSION_CREATED.
Returns: Returns the counterSend_EVT_SESSION_DELTA.
Returns: Returns the counterSend_EVT_SESSION_EXPIRED.
<description>/<version>
.Returns: The invalidated sessions array
Returns: Returns the processingTime.
Returns: The count
Returns: Returns the sendAllSessionsSize.
Returns: Returns the sendAllSessionsWaitTime in msec
Returns: Returns the sessionReplaceCounter.
Returns: Returns the stateTransferTimeout.
Parameters: msg sender
Throws: ClassNotFoundException IOException
Parameters: msg sender
Parameters: msg sender
Throws: IOException
Parameters: msg sender
Throws: IOException
Parameters: msg sender
Parameters: msg sender
Throws: IOException ClassNotFoundException
Parameters: msg sender
Throws: IOException
Returns: Returns the defaultMode.
Returns: Returns the notifySessionListenersOnReplication.
Returns: Returns the sendAllSessions.
Returns: Returns the stateTimestampDrop.
Parameters: cmsg - the message received.
Parameters: msg - the message received sender - 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 node
Parameters: event The property change event that has occurred
Parameters: session cross context session
Parameters: listener The listener to remove
Parameters: sessionId - the sessionId that just completed.
Returns: a SessionMessage to be sent,
Parameters: sessionId - the sessionId that just completed. expires - whether this method has been called during session expiration
Returns: a SessionMessage to be sent,
Parameters: msg Session message
Parameters: sessionId session
Parameters: sender currentSessions sendTimestamp
Throws: IOException
Parameters: deltaRequest
Returns: serialized delta request
Throws: IOException
Throws: IOException if an input/output error occurs
Parameters: id session id
Parameters: container The associated Container
Parameters: defaultMode The defaultMode to set.
Parameters: sendClusterDomainOnly The sendClusterDomainOnly to set.
Parameters: max The new maximum number of sessions
Parameters: notifyListenersCreateSessionOnReplication The notifySessionListenersOnReplication to set.
Parameters: sendAllSessions The sendAllSessions to set.
Parameters: sendAllSessionsSize The sendAllSessionsSize to set.
Parameters: sendAllSessionsWaitTime The sendAllSessionsWaitTime to set at msec.
Parameters: isTimestampDrop The new flag value
Parameters: stateTransfered
Parameters: timeoutAllSession The timeout
configure()
,
and before any of the public methods of the component are utilized.
Throws: LifecycleException if this component detects a fatal error that prevents this component from being used
Throws: LifecycleException if this component detects a fatal error that needs to be reported