Package org.apache.storm.scheduler.blacklist.strategies

## Class DefaultBlacklistStrategy

- java.lang.Object
- - org.apache.storm.scheduler.blacklist.strategies.DefaultBlacklistStrategy

- All Implemented Interfaces:
    `IBlacklistStrategy`
  Direct Known Subclasses:
    `RasBlacklistStrategy`

      public class DefaultBlacklistStrategy
      extends Object
      implements IBlacklistStrategy

  The default strategy used for blacklisting hosts.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_BLACKLIST_SCHEDULER_RESUME_TIME` |
    `static int` | `DEFAULT_BLACKLIST_SCHEDULER_TOLERANCE_COUNT` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultBlacklistStrategy()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected Map<String,​Set<String>>` | `createHostToSupervisorMap​(List<String> blacklistedNodeIds, Cluster cluster)` |
    `Set<String>` | `getBlacklist​(List<Map<String,​Set<Integer>>> supervisorsWithFailures, List<Map<String,​Integer>> sendAssignmentFailureCount, Cluster cluster, Topologies topologies)` | Get blacklist by blacklist strategy.
    `void` | `prepare​(Map<String,​Object> conf)` |
    `protected Set<String>` | `releaseBlacklistWhenNeeded​(Cluster cluster, List<String> blacklistedNodeIds)` | Decide when/if to release blacklisted hosts.
    `void` | `resumeFromBlacklist()` | resume supervisors form blacklist.

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

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

- - ### Field Detail

    - #### DEFAULT_BLACKLIST_SCHEDULER_RESUME_TIME

          public static final int DEFAULT_BLACKLIST_SCHEDULER_RESUME_TIME

      See Also:
        Constant Field Values

    - #### DEFAULT_BLACKLIST_SCHEDULER_TOLERANCE_COUNT

          public static final int DEFAULT_BLACKLIST_SCHEDULER_TOLERANCE_COUNT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DefaultBlacklistStrategy

          public DefaultBlacklistStrategy()

  - ### Method Detail

    - #### prepare

          public void prepare​(Map<String,​Object> conf)

      Specified by:
        `prepare` in interface `IBlacklistStrategy`

    - #### getBlacklist

          public Set<String> getBlacklist​(List<Map<String,​Set<Integer>>> supervisorsWithFailures,
                                          List<Map<String,​Integer>> sendAssignmentFailureCount,
                                          Cluster cluster,
                                          Topologies topologies)

      Description copied from interface: `IBlacklistStrategy`
      Get blacklist by blacklist strategy.
      Specified by:
        `getBlacklist` in interface `IBlacklistStrategy`
      Parameters:
        `supervisorsWithFailures` - bad supervisors buffered in sliding window
        `sendAssignmentFailureCount` - supervisors with failed assignment calls in sliding window
        `cluster` - the cluster these topologies are running in. `cluster` contains everything user need to develop a new scheduling logic. e.g. supervisors information, available slots, current assignments for all the topologies etc. User can set the new assignment for topologies using cluster.setAssignmentById()`
        `topologies` - all the topologies in the cluster, some of them need schedule. Topologies object here only contain static information about topologies. Information like assignments, slots are all in the `cluster` object.
      Returns:
        blacklisted supervisors' id set

    - #### resumeFromBlacklist

          public void resumeFromBlacklist()

      Description copied from interface: `IBlacklistStrategy`
      resume supervisors form blacklist. Blacklist is just a temporary list for supervisors, or there will be less and less available resources. This will be called every time before getBlacklist() and schedule.
      Specified by:
        `resumeFromBlacklist` in interface `IBlacklistStrategy`

    - #### releaseBlacklistWhenNeeded

          protected Set<String> releaseBlacklistWhenNeeded​(Cluster cluster,
                                                           List<String> blacklistedNodeIds)

      Decide when/if to release blacklisted hosts.
      Parameters:
        `cluster` - the current state of the cluster.
        `blacklistedNodeIds` - the current set of blacklisted node ids sorted by earliest
      Returns:
        the set of nodes to be released.

    - #### createHostToSupervisorMap

          protected Map<String,​Set<String>> createHostToSupervisorMap​(List<String> blacklistedNodeIds,
                                                                            Cluster cluster)