当前位置: 首页>>代码示例>>Java>>正文


Java FaultyMember.getCause方法代码示例

本文整理汇总了Java中org.apache.catalina.tribes.ChannelException.FaultyMember.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java FaultyMember.getCause方法的具体用法?Java FaultyMember.getCause怎么用?Java FaultyMember.getCause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.tribes.ChannelException.FaultyMember的用法示例。


在下文中一共展示了FaultyMember.getCause方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: publishEntryInfo

import org.apache.catalina.tribes.ChannelException.FaultyMember; //导入方法依赖的package包/类
/**
 * publish info about a map pair (key/value) to other nodes in the cluster
 * @param key Object
 * @param value Object
 * @return Member - the backup node
 * @throws ChannelException
 */
@Override
protected Member[] publishEntryInfo(Object key, Object value) throws ChannelException {
    if  (! (key instanceof Serializable && value instanceof Serializable)  ) return new Member[0];
    //select a backup node
    Member[] backup = getMapMembers();

    if (backup == null || backup.length == 0) return null;

    try {
        
        //publish the data out to all nodes
        MapMessage msg = new MapMessage(getMapContextName(), MapMessage.MSG_COPY, false,
                (Serializable) key, (Serializable) value, null,channel.getLocalMember(false), backup);

        getChannel().send(backup, msg, getChannelSendOptions());
    } catch (ChannelException e) {
        FaultyMember[] faultyMembers = e.getFaultyMembers();
        if (faultyMembers.length == 0) throw e;
        ArrayList<Member> faulty = new ArrayList<Member>();
        for (FaultyMember faultyMember : faultyMembers) {
            if (!(faultyMember.getCause() instanceof RemoteProcessException)) {
                faulty.add(faultyMember.getMember());
            }
        }
        Member[] realFaultyMembers = faulty.toArray(new Member[faulty.size()]);
        if (realFaultyMembers.length != 0) {
            backup = excludeFromSet(realFaultyMembers, backup);
            if (backup.length == 0) {
                throw e;
            } else {
                if (log.isWarnEnabled()) {
                    log.warn("Unable to replicate backup key:" + key
                            + ". Success nodes:" + Arrays.toString(backup)
                            + ". Failed nodes:" + Arrays.toString(realFaultyMembers), e);
                }
            }
        }
    }
    return backup;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:48,代码来源:ReplicatedMap.java

示例2: publishEntryInfo

import org.apache.catalina.tribes.ChannelException.FaultyMember; //导入方法依赖的package包/类
/**
 * publish info about a map pair (key/value) to other nodes in the cluster
 * 
 * @param key
 *            Object
 * @param value
 *            Object
 * @return Member - the backup node
 * @throws ChannelException
 */
@Override
protected Member[] publishEntryInfo(Object key, Object value) throws ChannelException {
	if (!(key instanceof Serializable && value instanceof Serializable))
		return new Member[0];
	// select a backup node
	Member[] backup = getMapMembers();

	if (backup == null || backup.length == 0)
		return null;

	try {

		// publish the data out to all nodes
		MapMessage msg = new MapMessage(getMapContextName(), MapMessage.MSG_COPY, false, (Serializable) key,
				(Serializable) value, null, channel.getLocalMember(false), backup);

		getChannel().send(backup, msg, getChannelSendOptions());
	} catch (ChannelException e) {
		FaultyMember[] faultyMembers = e.getFaultyMembers();
		if (faultyMembers.length == 0)
			throw e;
		ArrayList<Member> faulty = new ArrayList<Member>();
		for (FaultyMember faultyMember : faultyMembers) {
			if (!(faultyMember.getCause() instanceof RemoteProcessException)) {
				faulty.add(faultyMember.getMember());
			}
		}
		Member[] realFaultyMembers = faulty.toArray(new Member[faulty.size()]);
		if (realFaultyMembers.length != 0) {
			backup = excludeFromSet(realFaultyMembers, backup);
			if (backup.length == 0) {
				throw e;
			} else {
				if (log.isWarnEnabled()) {
					log.warn("Unable to replicate backup key:" + key + ". Success nodes:" + Arrays.toString(backup)
							+ ". Failed nodes:" + Arrays.toString(realFaultyMembers), e);
				}
			}
		}
	}
	return backup;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:53,代码来源:ReplicatedMap.java


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