• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CatalinaCluster类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.catalina.ha.CatalinaCluster的典型用法代码示例。如果您正苦于以下问题:Java CatalinaCluster类的具体用法?Java CatalinaCluster怎么用?Java CatalinaCluster使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CatalinaCluster类属于org.apache.catalina.ha包,在下文中一共展示了CatalinaCluster类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: sendSessionReplicationMessage

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * Send Cluster Replication Request
 * @param request current request
 * @param manager session manager
 * @param cluster replication cluster
 */
protected void sendSessionReplicationMessage(Request request,
        ClusterManager manager, CatalinaCluster cluster) {
    Session session = request.getSessionInternal(false);
    if (session != null) {
        String uri = request.getDecodedRequestURI();
        // request without session change
        if (!isRequestWithoutSessionChange(uri)) {
            if (log.isDebugEnabled())
                log.debug(sm.getString("ReplicationValve.invoke.uri", uri));
            sendMessage(session,manager,cluster);
        } else
            if(doStatistics())
                nrOfFilterRequests++;
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:23,代码来源:ReplicationValve.java


示例2: sendSessionIDClusterBackup

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:JvmRouteBinderValve.java


示例3: startInternal

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * 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 {

    try {
        CatalinaCluster catclust = (CatalinaCluster)this.getCluster();
        if (this.context == null) this.context = new ReplApplContext(this);
        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);
            if (getAltDDName() != null) context.setAttribute(Globals.ALT_DD_ATTR, getAltDDName());
        }
        super.startInternal();
    }  catch ( Exception x ) {
        log.error("Unable to start ReplicatedContext",x);
        throw new LifecycleException("Failed to start ReplicatedContext",x);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:29,代码来源:ReplicatedContext.java


示例4: sendReplicationMessage

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * @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);
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:33,代码来源:ReplicationValve.java


示例5: sendCrossContextSession

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * Send all changed cross context sessions to backups
 * @param containerCluster
 */
protected void sendCrossContextSession(CatalinaCluster containerCluster) {
    List<DeltaSession> sessions = crossContextSessions.get();
    if(sessions != null && sessions.size() >0) {
        for(Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext() ;) {          
            Session session = iter.next();
            if(log.isDebugEnabled())
                log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",  
                        session.getManager().getContainer().getName() ));
            sendMessage(session,(ClusterManager)session.getManager(),containerCluster);
            if(doStatistics()) {
                nrOfCrossContextSendRequests++;
            }
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:20,代码来源:ReplicationValve.java


示例6: sendSessionIDClusterBackup

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * 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);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:23,代码来源:JvmRouteBinderValve.java


示例7: startInternal

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * 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);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:25,代码来源:ReplicatedContext.java


示例8: sendCrossContextSession

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * Send all changed cross context sessions to backups
 * 
 * @param containerCluster
 */
protected void sendCrossContextSession(CatalinaCluster containerCluster) {
	List<DeltaSession> sessions = crossContextSessions.get();
	if (sessions != null && sessions.size() > 0) {
		for (Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext();) {
			Session session = iter.next();
			if (log.isDebugEnabled())
				log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",
						session.getManager().getContainer().getName()));
			sendMessage(session, (ClusterManager) session.getManager(), containerCluster);
			if (doStatistics()) {
				nrOfCrossContextSendRequests++;
			}
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:21,代码来源:ReplicationValve.java


示例9: sendSessionReplicationMessage

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * Send Cluster Replication Request
 * 
 * @param request
 *            current request
 * @param manager
 *            session manager
 * @param cluster
 *            replication cluster
 */
protected void sendSessionReplicationMessage(Request request, ClusterManager manager, CatalinaCluster cluster) {
	Session session = request.getSessionInternal(false);
	if (session != null) {
		String uri = request.getDecodedRequestURI();
		// request without session change
		if (!isRequestWithoutSessionChange(uri)) {
			if (log.isDebugEnabled())
				log.debug(sm.getString("ReplicationValve.invoke.uri", uri));
			sendMessage(session, manager, cluster);
		} else if (doStatistics())
			nrOfFilterRequests++;
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:25,代码来源:ReplicationValve.java


示例10: startInternal

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * 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
 */
@SuppressWarnings("unchecked")
@Override
protected synchronized void startInternal() throws LifecycleException {

    try {
        CatalinaCluster catclust = (CatalinaCluster)this.getCluster();
        if (this.context == null) this.context = new ReplApplContext(this);
        if ( catclust != null ) {
            ReplicatedMap map = new ReplicatedMap(this,catclust.getChannel(),DEFAULT_REPL_TIMEOUT,
                                                  getName(),getClassLoaders());
            map.setChannelSendOptions(mapSendOptions);
            ((ReplApplContext)this.context).setAttributeMap(map);
            if (getAltDDName() != null) context.setAttribute(Globals.ALT_DD_ATTR, getAltDDName());
        }
        super.startInternal();
    }  catch ( Exception x ) {
        log.error("Unable to start ReplicatedContext",x);
        throw new LifecycleException("Failed to start ReplicatedContext",x);
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:28,代码来源:ReplicatedContext.java


示例11: startInternal

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * 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 {

    try {
        CatalinaCluster catclust = (CatalinaCluster)this.getCluster();
        if (this.context == null) this.context = new ReplApplContext(this);
        if ( catclust != null ) {
            ReplicatedMap map = new ReplicatedMap(this,catclust.getChannel(),DEFAULT_REPL_TIMEOUT,
                                                  getName(),getClassLoaders());
            map.setChannelSendOptions(mapSendOptions);
            ((ReplApplContext)this.context).setAttributeMap(map);
            if (getAltDDName() != null) context.setAttribute(Globals.ALT_DD_ATTR, getAltDDName());
        }
        super.startInternal();
    }  catch ( Exception x ) {
        log.error("Unable to start ReplicatedContext",x);
        throw new LifecycleException("Failed to start ReplicatedContext",x);
    }
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:27,代码来源:ReplicatedContext.java


示例12: manageCluster

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
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);
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:24,代码来源:TomcatWebAppBuilder.java


示例13: startInternal

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
@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);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:12,代码来源:ClusterManagerBase.java


示例14: startInternal

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * 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);
        this.cache = cache;
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        throw new LifecycleException(
                "ClusterSingleSignOn exception during clusterLoad " + t);
    }

    super.startInternal();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:42,代码来源:ClusterSingleSignOn.java


示例15: startInternal

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:22,代码来源:ReplicationValve.java


示例16: sendMessage

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
* Send message delta message from request session 
* @param session current session
* @param manager session manager
* @param cluster replication cluster
*/
protected void sendMessage(Session session,
         ClusterManager manager, CatalinaCluster cluster) {
    String id = session.getIdInternal();
    if (id != null) {
        send(manager, cluster, id);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:ReplicationValve.java


示例17: send

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * send manager requestCompleted message to cluster
 * @param manager SessionManager
 * @param cluster replication cluster
 * @param sessionId sessionid from the manager
 * @see DeltaManager#requestCompleted(String)
 * @see SimpleTcpCluster#send(ClusterMessage)
 */
protected void send(ClusterManager manager, CatalinaCluster cluster, String sessionId) {
    ClusterMessage msg = manager.requestCompleted(sessionId);
    if (msg != null) {
        cluster.send(msg);
        if(doStatistics())
            nrOfSendRequests++;
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:ReplicationValve.java


示例18: sendInvalidSessions

import org.apache.catalina.ha.CatalinaCluster; //导入依赖的package包/类
/**
 * check for session invalidations
 * @param manager
 * @param cluster
 */
protected void sendInvalidSessions(ClusterManager manager, CatalinaCluster cluster) {
    String[] invalidIds=manager.getInvalidatedSessions();
    if ( invalidIds.length > 0 ) {
        for ( int i=0;i<invalidIds.length; i++ ) {
            try {
                send(manager,cluster,invalidIds[i]);
            } catch ( Exception x ) {
                log.error(sm.getString("ReplicationValve.send.invalid.failure",invalidIds[i]),x);
            }
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:ReplicationValve.java



注:本文中的org.apache.catalina.ha.CatalinaCluster类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IOExceptionWithCause类代码示例发布时间:2022-05-23
下一篇:
Java FileExistResponse类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap