DFSUtil.StaleAndSlowComparator (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs, class: DFSUtil, class: StaleAndSlowComparator

Package org.apache.hadoop.hdfs

# Class DFSUtil.StaleAndSlowComparator

java.lang.Object
org.apache.hadoop.hdfs.DFSUtil.ServiceComparator
org.apache.hadoop.hdfs.DFSUtil.StaleAndSlowComparator

All Implemented Interfaces:
  `Comparator<org.apache.hadoop.hdfs.protocol.DatanodeInfo>`

Enclosing class:
  DFSUtil

@Private public static class DFSUtil.StaleAndSlowComparator extends DFSUtil.ServiceComparator
Comparator for sorting DataNodeInfo[] based on slow, stale, entering_maintenance, decommissioning and decommissioned states. Order: live -> slow -> stale -> entering_maintenance -> decommissioning -> decommissioned

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StaleAndSlowComparator(boolean avoidStaleDataNodesForRead, long interval, boolean avoidSlowDataNodesForRead, Set<String> slowNodesUuidSet)`
  Constructor of ServiceAndStaleComparator

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compare(org.apache.hadoop.hdfs.protocol.DatanodeInfo a, org.apache.hadoop.hdfs.protocol.DatanodeInfo b)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.util.Comparator

  `equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- ## Constructor Details

  - ### StaleAndSlowComparator

    public StaleAndSlowComparator(boolean avoidStaleDataNodesForRead, long interval, boolean avoidSlowDataNodesForRead, Set<String> slowNodesUuidSet)
    Constructor of ServiceAndStaleComparator
    Parameters:
      `avoidStaleDataNodesForRead` - Whether or not to avoid using stale DataNodes for reading.
      `interval` - The time interval for marking datanodes as stale is passed from outside, since the interval may be changed dynamically.
      `avoidSlowDataNodesForRead` - Whether or not to avoid using slow DataNodes for reading.
      `slowNodesUuidSet` - Slow DataNodes UUID set.

- ## Method Details

  - ### compare

    public int compare(org.apache.hadoop.hdfs.protocol.DatanodeInfo a, org.apache.hadoop.hdfs.protocol.DatanodeInfo b)
    Specified by:
      `compare` in interface `Comparator<org.apache.hadoop.hdfs.protocol.DatanodeInfo>`
    Overrides:
      `compare` in class `DFSUtil.ServiceComparator`