use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class HeartbeatOperation method run.
@Override
public void run() {
ClusterServiceImpl service = getService();
MemberImpl member = service.getMember(getCallerAddress());
if (member == null) {
ILogger logger = getLogger();
if (logger.isFineEnabled()) {
logger.fine("Heartbeat received from an unknown endpoint: " + getCallerAddress());
}
return;
}
service.getClusterHeartbeatManager().onHeartbeat(member, timestamp);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class ClusterServiceImpl method removeMembersDeadWhileClusterIsNotActive.
void removeMembersDeadWhileClusterIsNotActive() {
lock.lock();
try {
MemberMap memberMap = memberMapRef.get();
MemberMap membersRemovedInNotActiveState = membersRemovedInNotActiveStateRef.get();
Collection<MemberImpl> members = membersRemovedInNotActiveState.getMembers();
membersRemovedInNotActiveStateRef.set(MemberMap.empty());
for (MemberImpl member : members) {
onMemberRemove(member, memberMap);
}
} finally {
lock.unlock();
}
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class ClusterServiceImpl method sendMemberListToMember.
public void sendMemberListToMember(Address target) {
if (!isMaster()) {
return;
}
if (thisAddress.equals(target)) {
return;
}
MemberImpl member = getMember(target);
String memberUuid = member != null ? member.getUuid() : null;
Collection<MemberImpl> members = getMemberImpls();
MemberInfoUpdateOperation op = new MemberInfoUpdateOperation(memberUuid, createMemberInfoList(members), clusterClock.getClusterTime(), null, false);
nodeEngine.getOperationService().send(op, target);
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class ClusterServiceImpl method doUpdateMembers.
private void doUpdateMembers(Collection<MemberInfo> members) {
MemberMap currentMemberMap = memberMapRef.get();
String scopeId = thisAddress.getScopeId();
Collection<MemberImpl> newMembers = new LinkedList<MemberImpl>();
MemberImpl[] updatedMembers = new MemberImpl[members.size()];
int memberIndex = 0;
for (MemberInfo memberInfo : members) {
Address address = memberInfo.getAddress();
MemberImpl member = currentMemberMap.getMember(address);
if (member == null) {
member = createMember(memberInfo, scopeId);
newMembers.add(member);
long now = clusterClock.getClusterTime();
clusterHeartbeatManager.onHeartbeat(member, now);
clusterHeartbeatManager.acceptMasterConfirmation(member, now);
repairPartitionTableIfReturningMember(member);
}
updatedMembers[memberIndex++] = member;
}
setMembers(updatedMembers);
sendMembershipEvents(currentMemberMap.getMembers(), newMembers);
MemberMap membersRemovedInNotActiveState = membersRemovedInNotActiveStateRef.get();
membersRemovedInNotActiveStateRef.set(MemberMap.cloneExcluding(membersRemovedInNotActiveState, updatedMembers));
clusterHeartbeatManager.heartbeat();
logger.info(membersString());
}
use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.
the class ClusterServiceImpl method membersString.
public String membersString() {
StringBuilder sb = new StringBuilder("\n\nMembers [");
Collection<MemberImpl> members = getMemberImpls();
sb.append(members != null ? members.size() : 0);
sb.append("] {");
if (members != null) {
for (Member member : members) {
sb.append("\n\t").append(member);
}
}
sb.append("\n}\n");
return sb.toString();
}
Aggregations