本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
示例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());
}
}
示例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);
}
示例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);
}
}
示例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()));
}