Java 类org.apache.catalina.Cluster 实例源码

项目:tomee    文件:TomcatWebAppBuilder.java   
private void manageCluster(final Cluster cluster) {
    if (cluster == null || cluster instanceof SimpleTomEETcpCluster) {
        return;
    }

    Cluster current = cluster;
    if (cluster instanceof SimpleTcpCluster) {
        final Container container = cluster.getContainer();
        current = new SimpleTomEETcpCluster((SimpleTcpCluster) cluster);
        container.setCluster(current);
    }

    if (current instanceof CatalinaCluster) {
        final CatalinaCluster haCluster = (CatalinaCluster) current;
        TomEEClusterListener listener = SystemInstance.get().getComponent(TomEEClusterListener.class);
        if (listener == null) {
            listener = new TomEEClusterListener();
            SystemInstance.get().setComponent(TomEEClusterListener.class, listener);
        }
        haCluster.addClusterListener(listener); // better to be a singleton
        clusters.add(haCluster);
    }
}
项目:tomcat7    文件:ClusterManagerBase.java   
@Override
protected void startInternal() throws LifecycleException {
    super.startInternal();
    if (getCluster() == null) {
        Cluster cluster = getContainer().getCluster();
        if (cluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster)cluster);
        }
    }
    if (cluster != null) cluster.registerManager(this);
}
项目:tomcat7    文件:ReplicationValve.java   
/**
 * 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 {
    if (cluster == null) {
        Cluster containerCluster = getContainer().getCluster();
        if (containerCluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster)containerCluster);
        } else {
            if (log.isWarnEnabled()) {
                log.warn(sm.getString("ReplicationValve.nocluster"));
            }
        }
    }
    super.startInternal();
}
项目:tomcat7    文件:ContainerBase.java   
/**
 * Return the Cluster with which this Container is associated.  If there is
 * no associated Cluster, return the Cluster associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Cluster getCluster() {
    if (cluster != null)
        return (cluster);

    if (parent != null)
        return (parent.getCluster());

    return (null);
}
项目:lams    文件:ContainerBase.java   
/**
 * Return the Cluster with which this Container is associated.  If there is
 * no associated Cluster, return the Cluster associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
public Cluster getCluster() {
    if (cluster != null)
        return (cluster);

    if (parent != null)
        return (parent.getCluster());

    return (null);
}
项目:jerrydog    文件:DistributedManager.java   
/**
 * Start this manager
 *
 * @exception LifecycleException if an error occurs
 */
public void start() throws LifecycleException {
    Container container = getContainer();
    Cluster cluster = null;

    if(container != null)
        cluster = container.getCluster();

    if(cluster != null) {
        this.clusterSender = cluster.getClusterSender(getName());
        this.clusterReceiver = cluster.getClusterReceiver(getName());
    }

    super.start();
}
项目:jerrydog    文件:ContainerBase.java   
/**
 * Return the Cluster with which this Container is associated.  If there is
 * no associated Cluster, return the Cluster associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
public Cluster getCluster() {
    if (cluster != null)
        return (cluster);

    if (parent != null)
        return (parent.getCluster());

    return (null);
}
项目:apache-tomcat-7.0.73-with-comment    文件:ClusterManagerBase.java   
@Override
protected void startInternal() throws LifecycleException {
    super.startInternal();
    if (getCluster() == null) {
        Cluster cluster = getContainer().getCluster();
        if (cluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster)cluster);
        }
    }
    if (cluster != null) cluster.registerManager(this);
}
项目:apache-tomcat-7.0.73-with-comment    文件:ReplicationValve.java   
/**
 * 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 {
    if (cluster == null) {
        Cluster containerCluster = getContainer().getCluster();
        if (containerCluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster)containerCluster);
        } else {
            if (log.isWarnEnabled()) {
                log.warn(sm.getString("ReplicationValve.nocluster"));
            }
        }
    }
    super.startInternal();
}
项目:lazycat    文件:ClusterManagerBase.java   
@Override
protected void startInternal() throws LifecycleException {
    super.startInternal();
    if (getCluster() == null) {
        Cluster cluster = getContainer().getCluster();
        if (cluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster) cluster);
        }
    }
    if (cluster != null)
        cluster.registerManager(this);
}
项目:lazycat    文件:ReplicationValve.java   
/**
 * 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 {
    if (cluster == null) {
        Cluster containerCluster = getContainer().getCluster();
        if (containerCluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster) containerCluster);
        } else {
            if (log.isWarnEnabled()) {
                log.warn(sm.getString("ReplicationValve.nocluster"));
            }
        }
    }
    super.startInternal();
}
项目:lazycat    文件:ContainerBase.java   
/**
 * Return the Cluster with which this Container is associated. If there is
 * no associated Cluster, return the Cluster associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Cluster getCluster() {
    if (cluster != null)
        return (cluster);

    if (parent != null)
        return (parent.getCluster());

    return (null);
}
项目:class-guard    文件:BackupManager.java   
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * Starts the cluster communication channel, this will connect with the
 * other nodes in the cluster, and request the current session state to be
 * transferred to this node.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@SuppressWarnings("unchecked")
@Override
protected synchronized void startInternal() throws LifecycleException {

    super.startInternal();

    try {
        if (getCluster() == null) {
            Cluster cluster = getContainer().getCluster();
            if (cluster instanceof CatalinaCluster) {
                setCluster((CatalinaCluster)cluster);
            } else {
                throw new LifecycleException(
                        sm.getString("backupManager.noCluster", getName()));
            }
        }
        cluster.registerManager(this);
        LazyReplicatedMap map = new LazyReplicatedMap(this,
                                                      cluster.getChannel(),
                                                      rpcTimeout,
                                                      getMapName(),
                                                      getClassLoaders(),
                                                      terminateOnStartFailure);
        map.setChannelSendOptions(mapSendOptions);
        this.sessions = map;
    }  catch ( Exception x ) {
        log.error(sm.getString("backupManager.startUnable", getName()),x);
        throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x);
    }
    setState(LifecycleState.STARTING);
}
项目:class-guard    文件:ReplicationValve.java   
/**
 * 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 {
    if (cluster == null) {
        Cluster containerCluster = getContainer().getCluster();
        if (containerCluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster)containerCluster);
        } else {
            if (log.isWarnEnabled()) {
                log.warn(sm.getString("ReplicationValve.nocluster"));
            }
        }
    }
    super.startInternal();
}
项目:class-guard    文件:ContainerBase.java   
/**
 * Return the Cluster with which this Container is associated.  If there is
 * no associated Cluster, return the Cluster associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Cluster getCluster() {
    if (cluster != null)
        return (cluster);

    if (parent != null)
        return (parent.getCluster());

    return (null);
}
项目:apache-tomcat-7.0.57    文件:ClusterManagerBase.java   
@Override
protected void startInternal() throws LifecycleException {
    super.startInternal();
    if (getCluster() == null) {
        Cluster cluster = getContainer().getCluster();
        if (cluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster)cluster);
        }
    }
    if (cluster != null) cluster.registerManager(this);
}
项目:apache-tomcat-7.0.57    文件:ReplicationValve.java   
/**
 * 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 {
    if (cluster == null) {
        Cluster containerCluster = getContainer().getCluster();
        if (containerCluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster)containerCluster);
        } else {
            if (log.isWarnEnabled()) {
                log.warn(sm.getString("ReplicationValve.nocluster"));
            }
        }
    }
    super.startInternal();
}
项目:apache-tomcat-7.0.57    文件:ContainerBase.java   
/**
 * Return the Cluster with which this Container is associated.  If there is
 * no associated Cluster, return the Cluster associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Cluster getCluster() {
    if (cluster != null)
        return (cluster);

    if (parent != null)
        return (parent.getCluster());

    return (null);
}
项目:apache-tomcat-7.0.57    文件:ClusterManagerBase.java   
@Override
protected void startInternal() throws LifecycleException {
    super.startInternal();
    if (getCluster() == null) {
        Cluster cluster = getContainer().getCluster();
        if (cluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster)cluster);
        }
    }
    if (cluster != null) cluster.registerManager(this);
}
项目:apache-tomcat-7.0.57    文件:ReplicationValve.java   
/**
 * 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 {
    if (cluster == null) {
        Cluster containerCluster = getContainer().getCluster();
        if (containerCluster instanceof CatalinaCluster) {
            setCluster((CatalinaCluster)containerCluster);
        } else {
            if (log.isWarnEnabled()) {
                log.warn(sm.getString("ReplicationValve.nocluster"));
            }
        }
    }
    super.startInternal();
}
项目:apache-tomcat-7.0.57    文件:ContainerBase.java   
/**
 * Return the Cluster with which this Container is associated.  If there is
 * no associated Cluster, return the Cluster associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Cluster getCluster() {
    if (cluster != null)
        return (cluster);

    if (parent != null)
        return (parent.getCluster());

    return (null);
}
项目:HowTomcatWorks    文件:DistributedManager.java   
/**
 * Start this manager
 *
 * @exception LifecycleException if an error occurs
 */
public void start() throws LifecycleException {
    Container container = getContainer();
    Cluster cluster = null;

    if(container != null)
        cluster = container.getCluster();

    if(cluster != null) {
        this.clusterSender = cluster.getClusterSender(getName());
        this.clusterReceiver = cluster.getClusterReceiver(getName());
    }

    super.start();
}
项目:HowTomcatWorks    文件:ContainerBase.java   
/**
 * Return the Cluster with which this Container is associated.  If there is
 * no associated Cluster, return the Cluster associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
public Cluster getCluster() {
    if (cluster != null)
        return (cluster);

    if (parent != null)
        return (parent.getCluster());

    return (null);
}
项目:WBSAirback    文件:ContainerBase.java   
/**
 * Return the Cluster with which this Container is associated.  If there is
 * no associated Cluster, return the Cluster associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Cluster getCluster() {
    if (cluster != null)
        return (cluster);

    if (parent != null)
        return (parent.getCluster());

    return (null);
}
项目:embed-apache-tomcat    文件:AbstractContainerBuilder.java   
@Override
@SuppressWarnings("unchecked")
public final T setCluster(Cluster cluster) {
    LOGGER.log(Level.FINE, "setCluster({0})", cluster.getClass().getName());
    cluster.setContainer(getContainer());
    container.setCluster(cluster);
    return (T) this;
}
项目:tomcat7    文件:FailedContext.java   
@Override
public Cluster getCluster() { return null; }
项目:tomcat7    文件:FailedContext.java   
@Override
public void setCluster(Cluster cluster) { /* NO-OP */ }
项目:tomcat7    文件:TesterContext.java   
@Override
public Cluster getCluster() {
    return null;
}
项目:tomcat7    文件:TesterContext.java   
@Override
public void setCluster(Cluster cluster) {
    // NO-OP
}
项目:tomcat7    文件:TesterHost.java   
@Override
public Cluster getCluster() {
    return null;
}
项目:tomcat7    文件:TesterHost.java   
@Override
public void setCluster(Cluster cluster) {
    // NO-OP
}
项目:apache-tomcat-7.0.73-with-comment    文件:FailedContext.java   
@Override
public Cluster getCluster() { return null; }
项目:apache-tomcat-7.0.73-with-comment    文件:FailedContext.java   
@Override
public void setCluster(Cluster cluster) { /* NO-OP */ }
项目:apache-tomcat-7.0.73-with-comment    文件:TesterContext.java   
@Override
public Cluster getCluster() {
    return null;
}
项目:apache-tomcat-7.0.73-with-comment    文件:TesterContext.java   
@Override
public void setCluster(Cluster cluster) {
    // NO-OP
}
项目:apache-tomcat-7.0.73-with-comment    文件:TesterHost.java   
@Override
public Cluster getCluster() {
    return null;
}
项目:apache-tomcat-7.0.73-with-comment    文件:TesterHost.java   
@Override
public void setCluster(Cluster cluster) {
    // NO-OP
}
项目:lazycat    文件:FailedContext.java   
@Override
public Cluster getCluster() {
    return null;
}
项目:lazycat    文件:FailedContext.java   
@Override
public void setCluster(Cluster cluster) {
    /* NO-OP */ }
项目:class-guard    文件:DeltaManager.java   
/**
 * 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();

    // Load unloaded sessions, if any
    try {
        //the channel is already running
        Cluster cluster = getCluster() ;
        // stop remove cluster binding
        if(cluster == null) {
            Container context = getContainer();
            if (context != null) {
                cluster = context.getCluster();
                if(cluster instanceof CatalinaCluster) {
                    setCluster((CatalinaCluster) cluster);
                } else {
                    cluster = null;
                }
            }
        }
        if (cluster == null) {
            log.error(sm.getString("deltaManager.noCluster", getName()));
            return;
        } else {
            if (log.isInfoEnabled()) {
                String type = "unknown" ;
                if( cluster.getContainer() instanceof Host){
                    type = "Host" ;
                } else if( cluster.getContainer() instanceof Engine){
                    type = "Engine" ;
                }
                log.info(sm.getString("deltaManager.registerCluster", getName(), type, cluster.getClusterName()));
            }
        }
        if (log.isInfoEnabled()) log.info(sm.getString("deltaManager.startClustering", getName()));
        //to survice context reloads, as only a stop/start is called, not
        // createManager
        cluster.registerManager(this);

        getAllClusterSessions();

    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log.error(sm.getString("deltaManager.managerLoad"), t);
    }

    setState(LifecycleState.STARTING);
}