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

Java Member类代码示例

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

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



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

示例1: memberDisappeared

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
/**
 * Cluster member is gone
 * 
 * @see org.apache.catalina.tribes.MembershipListener#memberDisappeared(org.apache.catalina.tribes.Member)
 */
@Override
public void memberDisappeared(Member member) {
    try {
        hasMembers = channel.hasMembers();            
        if (log.isInfoEnabled()) log.info("Received member disappeared:" + member);
        // Notify our interested LifecycleListeners
        fireLifecycleEvent(BEFORE_MEMBERUNREGISTER_EVENT, member);

        unregisterMember(member);

        // Notify our interested LifecycleListeners
        fireLifecycleEvent(AFTER_MEMBERUNREGISTER_EVENT, member);
    } catch (Exception x) {
        log.error("Unable remove cluster node from replication system.", x);
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:22,代码来源:SimpleTcpCluster.java


示例2: memberAdded

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
/**
 * New cluster member is registered
 * 
 * @see org.apache.catalina.tribes.MembershipListener#memberAdded(org.apache.catalina.tribes.Member)
 */
@Override
public void memberAdded(Member member) {
	try {
		hasMembers = channel.hasMembers();
		if (log.isInfoEnabled())
			log.info("Replication member added:" + member);
		// Notify our interested LifecycleListeners
		fireLifecycleEvent(BEFORE_MEMBERREGISTER_EVENT, member);

		registerMember(member);

		// Notify our interested LifecycleListeners
		fireLifecycleEvent(AFTER_MEMBERREGISTER_EVENT, member);
	} catch (Exception x) {
		log.error("Unable to connect to replication system.", x);
	}

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


示例3: send

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
/**
 * send a cluster message to one member
 * 
 * @param msg message to transfer
 * @param dest Receiver member
 * @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage,
 *      org.apache.catalina.tribes.Member)
 */
@Override
public void send(ClusterMessage msg, Member dest) {
    try {
        msg.setAddress(getLocalMember());
        int sendOptions = channelSendOptions;
        if (msg instanceof SessionMessage
                && ((SessionMessage)msg).getEventType() == SessionMessage.EVT_ALL_SESSION_DATA) {
            sendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK;
        }
        if (dest != null) {
            if (!getLocalMember().equals(dest)) {
                channel.send(new Member[] {dest}, msg, sendOptions);
            } else
                log.error("Unable to send message to local member " + msg);
        } else {
            Member[] destmembers = channel.getMembers();
            if (destmembers.length>0)
                channel.send(destmembers,msg, sendOptions);
            else if (log.isDebugEnabled()) 
                log.debug("No members in cluster, ignoring message:"+msg);
        }
    } catch (Exception x) {
        log.error("Unable to send message through cluster sender.", x);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:34,代码来源:SimpleTcpCluster.java


示例4: memberAdded

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
/**
 * New cluster member is registered
 * 
 * @see org.apache.catalina.tribes.MembershipListener#memberAdded(org.apache.catalina.tribes.Member)
 */
@Override
public void memberAdded(Member member) {
    try {
        hasMembers = channel.hasMembers();
        if (log.isInfoEnabled()) log.info("Replication member added:" + member);
        // Notify our interested LifecycleListeners
        fireLifecycleEvent(BEFORE_MEMBERREGISTER_EVENT, member);

        registerMember(member);

        // Notify our interested LifecycleListeners
        fireLifecycleEvent(AFTER_MEMBERREGISTER_EVENT, member);
    } catch (Exception x) {
        log.error("Unable to connect to replication system.", x);
    }

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


示例5: testCoord1

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
@Test
public void testCoord1() throws Exception {
    int expectedCount = channels[0].getMembers().length;
    for (int i = 1; i < CHANNEL_COUNT; i++) {
        assertEquals("Message count expected to be equal.", expectedCount,
                channels[i].getMembers().length);
    }
    Member member = coordinators[0].getCoordinator();
    int cnt = 0;
    while (member == null && (cnt++ < 100)) {
        try {
            Thread.sleep(100);
            member = coordinators[0].getCoordinator();
        } catch (Exception x) {
            /* Ignore */
        }
    }
    for (int i = 0; i < CHANNEL_COUNT; i++) {
        assertEquals(member, coordinators[i].getCoordinator());
    }
    System.out.println("Coordinator[1] is:" + member);
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:23,代码来源:TestNonBlockingCoordinator.java


示例6: handleViewConf

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
protected void handleViewConf(CoordinationMessage msg, Member sender,Membership merged) throws ChannelException {
    if ( viewId != null && msg.getId().equals(viewId) ) return;//we already have this view
    view = new Membership((MemberImpl)getLocalMember(false),AbsoluteOrder.comp,true);
    Arrays.fill(view,msg.getMembers());
    viewId = msg.getId();
    
    if ( viewId.equals(suggestedviewId) ) {
        suggestedView = null;
        suggestedviewId = null;
    }
    
    if (suggestedView != null && AbsoluteOrder.comp.compare(suggestedView.getMembers()[0],merged.getMembers()[0])<0 ) {
        suggestedView = null;
        suggestedviewId = null;
    }
    
    viewChange(viewId,view.getMembers());
    fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_CONF_RX,this,"Accepted View"));
    
    if ( suggestedviewId == null && hasHigherPriority(merged.getMembers(),membership.getMembers()) ) {
        startElection(false);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:NonBlockingCoordinator.java


示例7: broadcast

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
/**
 * Helper method to broadcast a message to all members in a channel
 * 
 * @param msgtype
 *            int
 * @param rpc
 *            boolean
 * @throws ChannelException
 */
protected void broadcast(int msgtype, boolean rpc) throws ChannelException {
	Member[] members = channel.getMembers();
	// No destination.
	if (members.length == 0)
		return;
	// send out a map membership message, only wait for the first reply
	MapMessage msg = new MapMessage(this.mapContextName, msgtype, false, null, null, null,
			channel.getLocalMember(false), null);
	if (rpc) {
		Response[] resp = rpcChannel.send(members, msg, RpcChannel.FIRST_REPLY, (channelSendOptions), rpcTimeout);
		if (resp.length > 0) {
			for (int i = 0; i < resp.length; i++) {
				mapMemberAdded(resp[i].getSource());
				messageReceived(resp[i].getMessage(), resp[i].getSource());
			}
		} else {
			log.warn("broadcast received 0 replies, probably a timeout.");
		}
	} else {
		channel.send(channel.getMembers(), msg, channelSendOptions);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:AbstractReplicatedMap.java


示例8: handleViewConf

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
protected void handleViewConf(CoordinationMessage msg, Member sender, Membership merged) throws ChannelException {
	if (viewId != null && msg.getId().equals(viewId))
		return;// we already have this view
	view = new Membership((MemberImpl) getLocalMember(false), AbsoluteOrder.comp, true);
	Arrays.fill(view, msg.getMembers());
	viewId = msg.getId();

	if (viewId.equals(suggestedviewId)) {
		suggestedView = null;
		suggestedviewId = null;
	}

	if (suggestedView != null
			&& AbsoluteOrder.comp.compare(suggestedView.getMembers()[0], merged.getMembers()[0]) < 0) {
		suggestedView = null;
		suggestedviewId = null;
	}

	viewChange(viewId, view.getMembers());
	fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_CONF_RX, this, "Accepted View"));

	if (suggestedviewId == null && hasHigherPriority(merged.getMembers(), membership.getMembers())) {
		startElection(false);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:26,代码来源:NonBlockingCoordinator.java


示例9: memberAdded

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
@Override
public void memberAdded(Member member) {
    if ( membership == null ) setupMembership();
    boolean notify = false;
    synchronized (membership) {
        if (removeSuspects.containsKey(member)) {
            //previously marked suspect, system below picked up the member again
            removeSuspects.remove(member);
        } else if (membership.getMember(member) == null){
            //if we add it here, then add it upwards too
            //check to see if it is alive
            if (memberAlive(member)) {
                membership.memberAlive( (MemberImpl) member);
                notify = true;
            } else {
                addSuspects.put(member, Long.valueOf(System.currentTimeMillis()));
            }
        }
    }
    if ( notify ) super.memberAdded(member);
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:22,代码来源:TcpFailureDetector.java


示例10: messageReceived

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
@Override
public void messageReceived(Serializable s, Member m) {
    Data d = (Data)s;
    if ( !Data.verify(d) ) {
        System.err.println("ERROR");
    } else {
        if (d.error) {
            errCnt++;
            if ( (errCnt % 100) == 0) {
                printStats(System.err);
            }
            throw new IllegalArgumentException();
        }
        noErrCnt++;
        if ( (noErrCnt % 100) == 0) {
            printStats(System.err);
        }
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:20,代码来源:TestRemoteProcessException.java


示例11: sendMessage

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    if ( access.addAndGet(1) == 1 ) txStart = System.currentTimeMillis();
    long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
    try {
        super.sendMessage(destination, msg, payload);
    }catch ( ChannelException x ) {
        msgTxErr.addAndGet(1);
        if ( access.get() == 1 ) access.addAndGet(-1);
        throw x;
    } 
    mbTx += (bytes*destination.length)/(1024d*1024d);
    mbAppTx += bytes/(1024d*1024d);
    if ( access.addAndGet(-1) == 0 ) {
        long stop = System.currentTimeMillis();
        timeTx += (stop - txStart) / 1000d;
        if ((msgTxCnt.get() / interval) >= lastCnt) {
            lastCnt++;
            report(timeTx);
        }
    }
    msgTxCnt.addAndGet(1);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:ThroughputInterceptor.java


示例12: getLocalMember

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
/**
 * Return the local member
 */
@Override
public Member getLocalMember(boolean alive) {
	if (alive && localMember != null && impl != null)
		localMember.setMemberAliveTime(System.currentTimeMillis() - impl.getServiceStartTime());
	return localMember;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:10,代码来源:McastService.java


示例13: compare

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
@Override
public int compare(Member m1, Member m2) {
    //longer alive time, means sort first
    long result = m2.getMemberAliveTime() - m1.getMemberAliveTime();
    if (result < 0)
        return -1;
    else if (result == 0)
        return 0;
    else
        return 1;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:12,代码来源:Membership.java


示例14: handleALL_SESSION_DATA

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
/**
 * handle receive sessions from other not ( restart )
 * @param msg
 * @param sender
 * @throws ClassNotFoundException
 * @throws IOException
 */
protected void handleALL_SESSION_DATA(SessionMessage msg,Member sender) throws ClassNotFoundException, IOException {
    counterReceive_EVT_ALL_SESSION_DATA++;
    if (log.isDebugEnabled()) log.debug(sm.getString("deltaManager.receiveMessage.allSessionDataBegin",getName()));
    byte[] data = msg.getSession();
    deserializeSessions(data);
    if (log.isDebugEnabled()) log.debug(sm.getString("deltaManager.receiveMessage.allSessionDataAfter",getName()));
    //stateTransferred = true;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:16,代码来源:DeltaManager.java


示例15: handleSESSION_ACCESSED

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
/**
 * handle receive session is access at other node ( primary session is now
 * false)
 * 
 * @param msg
 * @param sender
 * @throws IOException
 */
protected void handleSESSION_ACCESSED(SessionMessage msg, Member sender) throws IOException {
	counterReceive_EVT_SESSION_ACCESSED++;
	DeltaSession session = (DeltaSession) findSession(msg.getSessionID());
	if (session != null) {
		if (log.isDebugEnabled())
			log.debug(sm.getString("deltaManager.receiveMessage.accessed", getName(), msg.getSessionID()));
		session.access();
		session.setPrimarySession(false);
		session.endAccess();
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:20,代码来源:DeltaManager.java


示例16: sendMessage

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload)
		throws ChannelException {
	int size = msg.getMessage().getLength();
	boolean frag = (size > maxSize) && okToProcess(msg.getOptions());
	if (frag) {
		frag(destination, msg, payload);
	} else {
		msg.getMessage().append(frag);
		super.sendMessage(destination, msg, payload);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:13,代码来源:FragmentationInterceptor.java


示例17: sendMessages

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
public void sendMessages(long delay, long sleep) throws Exception {
    resetMessageCounters();
    Member local = channels[0].getLocalMember(true);
    Member dest = channels[1].getLocalMember(true);
    int n = 3;
    log.info("Sending " + n + " messages from [" + local.getName()
            + "] to [" + dest.getName() + "] with delay of " + delay
            + " ms between them.");
    for (int i = 0; i < n; i++) {
        channels[0].send(new Member[] { dest }, new TestMsg(), 0);
        boolean last = (i == n - 1);
        if (!last && delay > 0) {
            Thread.sleep(delay);
        }
    }
    log.info("Messages sent. Waiting no more than " + (sleep / 1000)
            + " seconds for them to be received");
    long startTime = System.currentTimeMillis();
    int countReceived;
    while ((countReceived = getReceivedMessageCount()) != n) {
        long time = System.currentTimeMillis();
        if ((time - startTime) > sleep) {
            fail("Only " + countReceived + " out of " + n
                    + " messages have been received in " + (sleep / 1000)
                    + " seconds");
            break;
        }
        Thread.sleep(100);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:31,代码来源:TestGroupChannelSenderConnections.java


示例18: handleOtherToken

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
protected void handleOtherToken(MemberImpl local, CoordinationMessage msg, Member sender,Membership merged) throws ChannelException {
    if ( local.equals(msg.getLeader()) ) {
        //I am the new leader
        //startElection(false);
    } else {
        msg.view = merged.getMembers();
        sendElectionMsgToNextInline(local,msg);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:NonBlockingCoordinator.java


示例19: getMapMembersExcl

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
public Member[] getMapMembersExcl(Member[] exclude) {
    synchronized (mapMembers) {
        @SuppressWarnings("unchecked") // mapMembers has the correct type
        HashMap<Member, Long> list = (HashMap<Member, Long>)mapMembers.clone();
        for (int i=0; i<exclude.length;i++) list.remove(exclude[i]);
        return getMapMembers(list);
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:9,代码来源:AbstractReplicatedMap.java


示例20: sendMessage

import org.apache.catalina.tribes.Member; //导入依赖的package包/类
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    int size = msg.getMessage().getLength();
    boolean frag = (size>maxSize) && okToProcess(msg.getOptions());
    if ( frag ) {
        frag(destination, msg, payload);
    } else {
        msg.getMessage().append(frag);
        super.sendMessage(destination, msg, payload);
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:12,代码来源:FragmentationInterceptor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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