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


Java Member类代码示例

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


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


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