コード例 #1
0
 Collection<HazelcastInstance> getAllHazelcastInstances() {
   Collection<HazelcastInstance> all = new LinkedList<HazelcastInstance>();
   for (NodeEngineImpl nodeEngine : nodes.values()) {
     if (nodeEngine.isActive()) {
       all.add(nodeEngine.getHazelcastInstance());
     }
   }
   return all;
 }
コード例 #2
0
 @Override
 public void doRun() {
   Collection<MemberInfo> lsMemberInfos = membersUpdate.getMemberInfos();
   List<Address> newMemberList = new ArrayList<Address>(lsMemberInfos.size());
   for (final MemberInfo memberInfo : lsMemberInfos) {
     newMemberList.add(memberInfo.address);
   }
   doCall(membersUpdate, newMemberList, true);
   systemLogService.logJoin("JoinRunnable update members done.");
   doCall(new SyncProcess(), newMemberList, false);
   systemLogService.logJoin("JoinRunnable sync done.");
   doCall(new ConnectionCheckCall(), newMemberList, false);
   systemLogService.logJoin("JoinRunnable connection check done.");
 }
コード例 #3
0
 private void registerClassDefinitions(
     final Collection<ClassDefinition> classDefinitions, boolean checkClassDefErrors) {
   final Map<Integer, ClassDefinition> classDefMap =
       new HashMap<Integer, ClassDefinition>(classDefinitions.size());
   for (ClassDefinition cd : classDefinitions) {
     if (classDefMap.containsKey(cd.getClassId())) {
       throw new HazelcastSerializationException(
           "Duplicate registration found for class-id[" + cd.getClassId() + "]!");
     }
     classDefMap.put(cd.getClassId(), cd);
   }
   for (ClassDefinition classDefinition : classDefinitions) {
     registerClassDefinition(classDefinition, classDefMap, checkClassDefErrors);
   }
 }
コード例 #4
0
  void updateMembers(Collection<MemberInfo> lsMemberInfos) {
    checkServiceThread();
    final Map<Address, MemberImpl> mapOldMembers = new HashMap<Address, MemberImpl>();
    for (MemberImpl member : lsMembers) {
      mapOldMembers.put(member.getAddress(), member);
    }
    if (mapOldMembers.size() == lsMemberInfos.size()) {
      boolean same = true;
      for (MemberInfo memberInfo : lsMemberInfos) {
        MemberImpl member = mapOldMembers.get(memberInfo.getAddress());
        if (member == null || !member.getUuid().equals(memberInfo.uuid)) {
          same = false;
          break;
        }
      }
      if (same) {
        logger.log(Level.FINEST, "No need to process member update...");
        return;
      }
    }

    logger.log(Level.FINEST, "Updating Members");
    lsMembers.clear();
    dataMemberCount.reset();
    mapMembers.clear();
    memberMasterConfirmationTimes.clear();
    for (MemberInfo memberInfo : lsMemberInfos) {
      MemberImpl member = mapOldMembers.get(memberInfo.address);
      if (member == null) {
        member = addMember(memberInfo.address, memberInfo.nodeType, memberInfo.uuid);
      } else {
        addMember(member);
      }
      member.didRead();
    }
    if (!lsMembers.contains(thisMember)) {
      throw new RuntimeException("Member list doesn't contain local member!");
    }
    heartBeater();
    node.getClusterImpl().setMembers(lsMembers);
    node.setJoined();
    logger.log(Level.INFO, this.toString());
  }