org.apache.catalina.ha.session.DeltaManager Java Examples

The following examples show how to use org.apache.catalina.ha.session.DeltaManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleTcpCluster.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Create new Manager without add to cluster (comes with start the manager)
 *
 * @param name
 *            Context Name of this manager
 * @see org.apache.catalina.Cluster#createManager(java.lang.String)
 * @see DeltaManager#start()
 */
@Override
public synchronized Manager createManager(String name) {
    if (log.isDebugEnabled()) {
        log.debug("Creating ClusterManager for context " + name +
                " using class " + getManagerTemplate().getClass().getName());
    }
    ClusterManager manager = null;
    try {
        manager = managerTemplate.cloneFromTemplate();
        manager.setName(name);
    } catch (Exception x) {
        log.error(sm.getString("simpleTcpCluster.clustermanager.cloneFailed"), x);
        manager = new org.apache.catalina.ha.session.DeltaManager();
    } finally {
        if ( manager != null) manager.setCluster(this);
    }
    return manager;
}
 
Example #2
Source File: ReplicationValve.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * @param request
 * @param totalstart
 * @param isCrossContext
 * @param clusterManager
 * @param containerCluster
 */
protected void sendReplicationMessage(Request request, long totalstart, boolean isCrossContext, ClusterManager clusterManager, CatalinaCluster containerCluster) {
    //this happens after the request
    long start = 0;
    if(doStatistics()) {
        start = System.currentTimeMillis();
    }
    try {
        // send invalid sessions
        // DeltaManager returns String[0]
        if (!(clusterManager instanceof DeltaManager))
            sendInvalidSessions(clusterManager, containerCluster);
        // send replication
        sendSessionReplicationMessage(request, clusterManager, containerCluster);
        if(isCrossContext)
            sendCrossContextSession(containerCluster);
    } catch (Exception x) {
        // FIXME we have a lot of sends, but the trouble with one node stops the correct replication to other nodes!
        log.error(sm.getString("ReplicationValve.send.failure"), x);
    } finally {
        // FIXME this stats update are not cheap!!
        if(doStatistics()) {
            updateStats(totalstart,start);
        }
    }
}
 
Example #3
Source File: SimpleTcpCluster.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Create new Manager without add to cluster (comes with start the manager)
 * 
 * @param name
 *            Context Name of this manager
 * @see org.apache.catalina.Cluster#createManager(java.lang.String)
 * @see DeltaManager#start()
 */
@Override
public synchronized Manager createManager(String name) {
    if (log.isDebugEnabled()) {
        log.debug("Creating ClusterManager for context " + name +
                " using class " + getManagerTemplate().getClass().getName());
    }
    ClusterManager manager = null;
    try {
        manager = managerTemplate.cloneFromTemplate();
        manager.setName(name);
    } catch (Exception x) {
        log.error("Unable to clone cluster manager, defaulting to org.apache.catalina.ha.session.DeltaManager", x);
        manager = new org.apache.catalina.ha.session.DeltaManager();
    } finally {
        if ( manager != null) manager.setCluster(this);
    }
    return manager;
}
 
Example #4
Source File: ReplicationValve.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * @param request
 * @param totalstart
 * @param isCrossContext
 * @param clusterManager
 * @param containerCluster
 */
protected void sendReplicationMessage(Request request, long totalstart, boolean isCrossContext, ClusterManager clusterManager, CatalinaCluster containerCluster) {
    //this happens after the request
    long start = 0;
    if(doStatistics()) {
        start = System.currentTimeMillis();
    }
    try {
        // send invalid sessions
        // DeltaManager returns String[0]
        if (!(clusterManager instanceof DeltaManager))
            sendInvalidSessions(clusterManager, containerCluster);
        // send replication
        sendSessionReplicationMessage(request, clusterManager, containerCluster);
        if(isCrossContext)
            sendCrossContextSession(containerCluster);
    } catch (Exception x) {
        // FIXME we have a lot of sends, but the trouble with one node stops the correct replication to other nodes!
        log.error(sm.getString("ReplicationValve.send.failure"), x);
    } finally {
        // FIXME this stats update are not cheap!!
        if(doStatistics()) {
            updateStats(totalstart,start);
        }
    }
}
 
Example #5
Source File: SimpleTcpCluster.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Create new Manager without add to cluster (comes with start the manager)
 * 
 * @param name
 *            Context Name of this manager
 * @see org.apache.catalina.Cluster#createManager(java.lang.String)
 * @see DeltaManager#start()
 */
@Override
public synchronized Manager createManager(String name) {
    if (log.isDebugEnabled()) {
        log.debug("Creating ClusterManager for context " + name +
                " using class " + getManagerTemplate().getClass().getName());
    }
    ClusterManager manager = null;
    try {
        manager = managerTemplate.cloneFromTemplate();
        manager.setName(name);
    } catch (Exception x) {
        log.error("Unable to clone cluster manager, defaulting to org.apache.catalina.ha.session.DeltaManager", x);
        manager = new org.apache.catalina.ha.session.DeltaManager();
    } finally {
        if ( manager != null) manager.setCluster(this);
    }
    return manager;
}
 
Example #6
Source File: ReplicationValve.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
protected void sendReplicationMessage(Request request, long totalstart, boolean isCrossContext, ClusterManager clusterManager) {
    //this happens after the request
    long start = 0;
    if(doStatistics()) {
        start = System.currentTimeMillis();
    }
    try {
        // send invalid sessions
        // DeltaManager returns String[0]
        if (!(clusterManager instanceof DeltaManager)) {
            sendInvalidSessions(clusterManager);
        }
        // send replication
        sendSessionReplicationMessage(request, clusterManager);
        if(isCrossContext) {
            sendCrossContextSession();
        }
    } catch (Exception x) {
        // FIXME we have a lot of sends, but the trouble with one node stops the correct replication to other nodes!
        log.error(sm.getString("ReplicationValve.send.failure"), x);
    } finally {
        // FIXME this stats update are not cheap!!
        if(doStatistics()) {
            updateStats(totalstart,start);
        }
    }
}