コード例 #1
0
 @Override
 public boolean isMemberSafe(Member member) {
   if (member == null) {
     throw new NullPointerException("Parameter member should not be null");
   }
   final MemberImpl localMember = getNode().getLocalMember();
   if (localMember.equals(member)) {
     return isLocalMemberSafe();
   }
   final Address target = member.getAddress();
   final Operation operation = new SafeStateCheckOperation();
   final InternalCompletableFuture future =
       getNode()
           .getNodeEngine()
           .getOperationService()
           .invokeOnTarget(InternalPartitionService.SERVICE_NAME, operation, target);
   boolean safe;
   try {
     final Object result = future.get(10, TimeUnit.SECONDS);
     safe = (Boolean) result;
   } catch (Throwable t) {
     safe = false;
     logger.warning("Error while querying member's safe state [" + member + "]", t);
   }
   return safe;
 }
コード例 #2
0
 public void updateMemberAttribute(
     String uuid, MemberAttributeOperationType operationType, String key, Object value) {
   lock.lock();
   try {
     Map<Address, MemberImpl> memberMap = membersMapRef.get();
     for (MemberImpl member : memberMap.values()) {
       if (member.getUuid().equals(uuid)) {
         if (!member.equals(getLocalMember())) {
           member.updateAttribute(operationType, key, value);
         }
         sendMemberAttributeEvent(member, operationType, key, value);
         break;
       }
     }
   } finally {
     lock.unlock();
   }
 }