ClusterSessionListenerpublic class ClusterSessionListener extends ClusterListener Receive replicated SessionMessage form other cluster node. |
Fields Summary |
---|
protected static final String | infoThe descriptive information about this implementation. |
Constructors Summary |
---|
public ClusterSessionListener()
//--Constructor---------------------------------------------
|
Methods Summary |
---|
public boolean | accept(org.apache.catalina.ha.ClusterMessage msg)Accept only SessionMessage
return (msg instanceof SessionMessage);
| public java.lang.String | getInfo()Return descriptive information about this implementation.
return (info);
| public void | messageReceived(org.apache.catalina.ha.ClusterMessage myobj)Callback from the cluster, when a message is received, The cluster will
broadcast it invoking the messageReceived on the receiver.
if (myobj != null && myobj instanceof SessionMessage) {
SessionMessage msg = (SessionMessage) myobj;
String ctxname = msg.getContextName();
//check if the message is a EVT_GET_ALL_SESSIONS,
//if so, wait until we are fully started up
Map managers = cluster.getManagers() ;
if (ctxname == null) {
java.util.Iterator i = managers.keySet().iterator();
while (i.hasNext()) {
String key = (String) i.next();
ClusterManager mgr = (ClusterManager) managers.get(key);
if (mgr != null)
mgr.messageDataReceived(msg);
else {
//this happens a lot before the system has started
// up
if (log.isDebugEnabled())
log.debug("Context manager doesn't exist:"
+ key);
}
}
} else {
ClusterManager mgr = (ClusterManager) managers.get(ctxname);
if (mgr != null)
mgr.messageDataReceived(msg);
else if (log.isWarnEnabled())
log.warn("Context manager doesn't exist:" + ctxname);
}
}
return;
|
|