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


Java MembershipEvent.getMember方法代码示例

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


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

示例1: memberAdded

import com.hazelcast.core.MembershipEvent; //导入方法依赖的package包/类
@Override
public synchronized void memberAdded(MembershipEvent membershipEvent) {
  if (!active) {
    return;
  }
  try {
    multimaps.forEach(HazelcastAsyncMultiMap::clearCache);
    if (nodeListener != null) {
      Member member = membershipEvent.getMember();
      members.add(member);
      nodeListener.nodeAdded(member.getUuid());
    }
  } catch (Throwable t) {
    log.error("Failed to handle memberAdded", t);
  }
}
 
开发者ID:vert-x3,项目名称:vertx-hazelcast,代码行数:17,代码来源:HazelcastClusterManager.java

示例2: memberRemoved

import com.hazelcast.core.MembershipEvent; //导入方法依赖的package包/类
@Override
public synchronized void memberRemoved(MembershipEvent membershipEvent) {
  if (!active) {
    return;
  }
  try {
    multimaps.forEach(HazelcastAsyncMultiMap::clearCache);
    if (nodeListener != null) {
      Member member = membershipEvent.getMember();
      members.remove(member);
      nodeListener.nodeLeft(member.getUuid());
    }
  } catch (Throwable t) {
    log.error("Failed to handle memberRemoved", t);
  }
}
 
开发者ID:vert-x3,项目名称:vertx-hazelcast,代码行数:17,代码来源:HazelcastClusterManager.java

示例3: memberAdded

import com.hazelcast.core.MembershipEvent; //导入方法依赖的package包/类
@Override
public void memberAdded(MembershipEvent membershipEvent) {
    Member member = membershipEvent.getMember();

    // Send all cluster messages
    carbonCluster.memberAdded(member);
    log.info(String.format("Member joined: [UUID] %s, [Address] %s", member.getUuid(), member.getSocketAddress().toString()));
    // Wait for sometime for the member to completely join before
    // replaying messages
    try {
        Thread.sleep(5000);
    } catch (InterruptedException ignored) {
    }
    HazelcastUtil.sendMessagesToMember(messageBuffer, member, carbonCluster);
}
 
开发者ID:wso2,项目名称:mesos-artifacts,代码行数:16,代码来源:MesosMembershipScheme.java

示例4: controllerRemoved

import com.hazelcast.core.MembershipEvent; //导入方法依赖的package包/类
@Override
	public void controllerRemoved(MembershipEvent event) {
		Member m = event.getMember();
		log.info("{} disconnected", m.getUuid());
		controllerLoad.remove(m.getUuid());// 移除故障控制器负载
		List<String> load = ImmutableList.copyOf(getSortedControllerLoad());// 取得控制器负载排序
		String uuid = floodlightProvider.getControllerModel().getControllerId();// 得到本机uuid
		ControllerModel c = controllers.get(m.getUuid());// 得到故障控制器模型
		Collection<SwitchConnectModel> switchs = controllerMappingSwitch.get(c);// 得到故障控制器控制的交换机
		if (!load.isEmpty()&&uuid.equals(load.get(0))) {
			for (SwitchConnectModel s : switchs) {// 遍历交换机a
				if(!s.getRole().equals(OFControllerRole.ROLE_MASTER.toString())) continue;
				DatapathId dpid = DatapathId.of(s.getDpid());
//				removeMasterMap(dpid.toString());
				for (int i = 0; i < load.size(); i++) {
					if (isConnected(s.getDpid(), load.get(i))) {
						IOFSwitch sw = switchService.getSwitch(dpid);
						log.info("change master {}<-->{}", uuid, dpid);
						sw.writeRequest(sw.getOFFactory().buildRoleRequest()
								.setGenerationId(U64.ZERO)
								.setRole(OFControllerRole.ROLE_MASTER).build());
						break;
					}
				}
			}
			controllerMappingSwitch.remove(c);
			controllers.remove(c.getControllerId());
		}
	}
 
开发者ID:DaiDongLiang,项目名称:DSC,代码行数:30,代码来源:ClusterManager.java

示例5: memberAdded

import com.hazelcast.core.MembershipEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void memberAdded(MembershipEvent membershipEvent) {
    Member member = membershipEvent.getMember();
    log.info("Handling cluster gossip: New member joined to the cluster. Member Socket Address:"
            + member.getSocketAddress() + " UUID:" + member.getUuid());

    checkAndNotifyCoordinatorChange();

    int maximumNumOfTries = 3;
    String nodeId;
    int numberOfAttemptsTried = 0;
    /*
     * Try a few times until nodeId is read from distributed Hazelcast Map
     * and give up
     */
    nodeId = configurableClusterAgent.getIdOfNode(member);
    if (null == nodeId) {
        while (numberOfAttemptsTried < maximumNumOfTries) {
            try {
                // Exponentially increase waiting time
                long sleepTime = Math.round(Math.pow(2, (numberOfAttemptsTried)));
                TimeUnit.SECONDS.sleep(sleepTime);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
            nodeId = configurableClusterAgent.getIdOfNode(member);
            numberOfAttemptsTried = numberOfAttemptsTried + 1;
            if (!(StringUtils.isEmpty(nodeId))) {
                break;
            }
        }
    }
    if (StringUtils.isEmpty(nodeId)) {
        log.warn("Node ID is not set for member " + member + " when newly joined");
    }
    configurableClusterAgent.memberAdded(nodeId);
}
 
开发者ID:wso2,项目名称:andes,代码行数:41,代码来源:HazelcastCoordinationStrategy.java

示例6: memberRemoved

import com.hazelcast.core.MembershipEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void memberRemoved(MembershipEvent membershipEvent) {
    Member member = membershipEvent.getMember();
    log.info("Handling cluster gossip: A member left the cluster. Member Socket Address:"
            + member.getSocketAddress() + " UUID:" + member.getUuid());

    try {
        checkAndNotifyCoordinatorChange();
        configurableClusterAgent.memberRemoved(configurableClusterAgent.getIdOfNode(member));
    } catch (AndesException e) {
        log.error("Error while handling node removal, " + member.getSocketAddress(), e);
    }
}
 
开发者ID:wso2,项目名称:andes,代码行数:17,代码来源:HazelcastCoordinationStrategy.java

示例7: memberRemoved

import com.hazelcast.core.MembershipEvent; //导入方法依赖的package包/类
@Override
public void memberRemoved(MembershipEvent membershipEvent) {
    Member member = membershipEvent.getMember();
    carbonCluster.memberRemoved(member);
    log.info(String.format("Member left: [UUID] %s, [Address] %s", member.getUuid(), member.getSocketAddress().toString()));
}
 
开发者ID:wso2,项目名称:mesos-artifacts,代码行数:7,代码来源:MesosMembershipScheme.java


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