@Override
  public boolean setDisksState(List<DiskId> diskIds, HardwareState state) {
    if (diskIds == null || diskIds.isEmpty()) {
      // when calling this method, we know that some disks are bad, so empty list is not allowed.
      throw new IllegalArgumentException("List of disk is empty when set disks state");
    }
    for (DiskId diskId : diskIds) {
      if (!(diskId instanceof AmbryDisk)) {
        throw new IllegalArgumentException(
            "HelixParticipant only works with the AmbryDisk implementation of DiskId: " + diskIds);
      }
    }
    synchronized (helixAdministrationLock) {
      // update availability in DataNodeConfig.
      DataNodeConfig dataNodeConfig = getDataNodeConfig();
      boolean success = true;
      boolean dataNodeConfigChanged = false;
      for (DiskId diskId : diskIds) {
        DataNodeConfig.DiskConfig diskConfig = dataNodeConfig.getDiskConfigs().get(diskId.getMountPath());
        if (diskConfig == null) {
          throw new IllegalArgumentException(
              "Disk " + diskId.getMountPath() + " can't be found in the failed DataNodeConfig");
        }
        if (diskConfig.getState() != state) {
          logger.info("Setting disk {} state from {} to {}", diskId.getMountPath(), diskConfig.getState(), state);
          dataNodeConfigChanged = true;
          DataNodeConfig.DiskConfig newDiskConfig =
              new DataNodeConfig.DiskConfig(state, diskConfig.getDiskCapacityInBytes());
          newDiskConfig.getReplicaConfigs().putAll(diskConfig.getReplicaConfigs());
          dataNodeConfig.getDiskConfigs().put(diskId.getMountPath(), newDiskConfig);
        }
      }

      if (dataNodeConfigChanged) {
        if (!dataNodeConfigSource.set(dataNodeConfig)) {
          logger.error("Setting disks {} state failed DataNodeConfig update", diskIds);
          success = false;
        }
      }
      return success;
    }
  }
@return a snapshot of registered state change listeners.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixParticipant.java