use of org.apache.catalina.ha.CatalinaCluster in project tomcat70 by apache.
the class DeltaSession method expire.
public void expire(boolean notify, boolean notifyCluster) {
// isValid is false
if (!isValid)
return;
synchronized (this) {
// Double check locking - isValid needs to be volatile
if (!isValid)
return;
if (manager == null)
return;
String expiredId = getIdInternal();
if (notifyCluster && expiredId != null && manager instanceof DeltaManager) {
DeltaManager dmanager = (DeltaManager) manager;
CatalinaCluster cluster = dmanager.getCluster();
ClusterMessage msg = dmanager.requestCompleted(expiredId, true);
if (msg != null) {
cluster.send(msg);
}
}
super.expire(notify);
if (notifyCluster) {
if (log.isDebugEnabled())
log.debug(sm.getString("deltaSession.notifying", ((ClusterManager) manager).getName(), Boolean.valueOf(isPrimarySession()), expiredId));
if (manager instanceof DeltaManager) {
((DeltaManager) manager).sessionExpired(expiredId);
}
}
}
}
use of org.apache.catalina.ha.CatalinaCluster in project tomcat70 by apache.
the class JvmRouteBinderValve method sendSessionIDClusterBackup.
/**
* Send the changed Sessionid to all clusternodes.
*
* @see JvmRouteSessionIDBinderListener#messageReceived(
* org.apache.catalina.ha.ClusterMessage)
* @param sessionId
* current failed sessionid
* @param newSessionID
* new session id, bind to the new cluster node
*/
protected void sendSessionIDClusterBackup(Request request, String sessionId, String newSessionID) {
CatalinaCluster c = getCluster();
if (c != null && !(getManager(request) instanceof BackupManager)) {
SessionIDMessage msg = new SessionIDMessage();
msg.setOrignalSessionID(sessionId);
msg.setBackupSessionID(newSessionID);
Context context = request.getContext();
msg.setContextName(context.getName());
msg.setHost(context.getParent().getName());
c.send(msg);
}
}
use of org.apache.catalina.ha.CatalinaCluster in project tomcat70 by apache.
the class ClusterSingleSignOn method startInternal.
// ------------------------------------------------------- Lifecycle Methods
/**
* Start this component and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
// Load the cluster component, if any
try {
if (cluster == null) {
Container host = getContainer();
if (host instanceof Host) {
if (host.getCluster() instanceof CatalinaCluster) {
setCluster((CatalinaCluster) host.getCluster());
}
}
}
if (cluster == null) {
throw new LifecycleException("There is no Cluster for ClusterSingleSignOn");
}
ClassLoader[] cls = new ClassLoader[] { this.getClass().getClassLoader() };
ReplicatedMap<String, SingleSignOnEntry> cache = new ReplicatedMap<String, SingleSignOnEntry>(this, cluster.getChannel(), rpcTimeout, cluster.getClusterName() + "-SSO-cache", cls, terminateOnStartFailure);
cache.setChannelSendOptions(mapSendOptions);
cache.setAccessTimeout(accessTimeout);
this.cache = cache;
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
throw new LifecycleException("ClusterSingleSignOn exception during clusterLoad " + t);
}
super.startInternal();
}
use of org.apache.catalina.ha.CatalinaCluster in project tomcat70 by apache.
the class ReplicatedContext method startInternal.
/**
* Start this component and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
super.startInternal();
try {
CatalinaCluster catclust = (CatalinaCluster) this.getCluster();
if (catclust != null) {
ReplicatedMap<String, Object> map = new ReplicatedMap<String, Object>(this, catclust.getChannel(), DEFAULT_REPL_TIMEOUT, getName(), getClassLoaders());
map.setChannelSendOptions(mapSendOptions);
((ReplApplContext) this.context).setAttributeMap(map);
}
} catch (Exception x) {
log.error("Unable to start ReplicatedContext", x);
throw new LifecycleException("Failed to start ReplicatedContext", x);
}
}
Aggregations