Package org.apache.storm.scheduler

## Class SchedulerAssignmentImpl

- java.lang.Object
- - org.apache.storm.scheduler.SchedulerAssignmentImpl

- All Implemented Interfaces:
    `SchedulerAssignment`

      public class SchedulerAssignmentImpl
      extends Object
      implements SchedulerAssignment

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SchedulerAssignmentImpl​(String topologyId)` |
    `SchedulerAssignmentImpl​(String topologyId, Map<ExecutorDetails,​WorkerSlot> executorToSlot, Map<WorkerSlot,​WorkerResources> resources, Map<String,​Double> nodeIdToTotalSharedOffHeap)` | Create a new assignment.
    `SchedulerAssignmentImpl​(SchedulerAssignment assignment)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `assign​(WorkerSlot slot, Collection<ExecutorDetails> executors)` | Deprecated.
    `void` | `assign​(WorkerSlot slot, Collection<ExecutorDetails> executors, WorkerResources slotResources)` | Assign the slot to executors.
    `boolean` | `equals​(Object other)` |
    `boolean` | `equalsIgnoreResources​(Object other)` | Like the equals command, but ignores the resources.
    `Set<ExecutorDetails>` | `getExecutors()` | Get the set of all executors.
    `Map<ExecutorDetails,​WorkerSlot>` | `getExecutorToSlot()` | Get the map of executor to WorkerSlot.
    `Map<String,​Double>` | `getNodeIdToTotalSharedOffHeapNodeMemory()` | Get the total shared off heap node memory mapping.
    `Map<WorkerSlot,​WorkerResources>` | `getScheduledResources()` | Get the slot to resource mapping.
    `Set<WorkerSlot>` | `getSlots()` | Get the set of all slots that are a part of this.
    `Map<WorkerSlot,​Collection<ExecutorDetails>>` | `getSlotToExecutors()` | Get the mapping of slot to executors on that slot.
    `String` | `getTopologyId()` | Return the ID of the topology.
    `int` | `hashCode()` |
    `boolean` | `isExecutorAssigned​(ExecutorDetails executor)` | Is the executor assigned or not.
    `boolean` | `isSlotOccupied​(WorkerSlot slot)` | Is this slot part of this assignment or not.
    `void` | `setTotalSharedOffHeapNodeMemory​(String node, double value)` |
    `String` | `toString()` |
    `void` | `unassignBySlot​(WorkerSlot slot)` | Release the slot occupied by this assignment.

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SchedulerAssignmentImpl

          public SchedulerAssignmentImpl​(String topologyId,
                                         Map<ExecutorDetails,​WorkerSlot> executorToSlot,
                                         Map<WorkerSlot,​WorkerResources> resources,
                                         Map<String,​Double> nodeIdToTotalSharedOffHeap)

      Create a new assignment.
      Parameters:
        `topologyId` - the id of the topology the assignment is for.
        `executorToSlot` - the executor to slot mapping for the assignment. Can be null and set through other methods later.
        `resources` - the resources for the current assignments. Can be null and set through other methods later.
        `nodeIdToTotalSharedOffHeap` - the shared memory for this assignment can be null and set through other methods later.

    - #### SchedulerAssignmentImpl

          public SchedulerAssignmentImpl​(String topologyId)

    - #### SchedulerAssignmentImpl

          public SchedulerAssignmentImpl​(SchedulerAssignment assignment)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equalsIgnoreResources

          public boolean equalsIgnoreResources​(Object other)

      Like the equals command, but ignores the resources.
      Parameters:
        `other` - the object to check for equality against.
      Returns:
        true if they are equal, ignoring resources, else false.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals​(Object other)

      Overrides:
        `equals` in class `Object`

    - #### getSlots

          public Set<WorkerSlot> getSlots()

      Description copied from interface: `SchedulerAssignment`
      Get the set of all slots that are a part of this.
      Specified by:
        `getSlots` in interface `SchedulerAssignment`
      Returns:
        the set of all slots.

    - #### assign

          @Deprecated
          public void assign​(WorkerSlot slot,
                             Collection<ExecutorDetails> executors)

      Deprecated.

    - #### assign

          public void assign​(WorkerSlot slot,
                             Collection<ExecutorDetails> executors,
                             WorkerResources slotResources)

      Assign the slot to executors.

    - #### unassignBySlot

          public void unassignBySlot​(WorkerSlot slot)

      Release the slot occupied by this assignment.

    - #### isSlotOccupied

          public boolean isSlotOccupied​(WorkerSlot slot)

      Description copied from interface: `SchedulerAssignment`
      Is this slot part of this assignment or not.
      Specified by:
        `isSlotOccupied` in interface `SchedulerAssignment`
      Parameters:
        `slot` - the slot to check.
      Returns:
        true if the slot is occupied by this assignment else false.

    - #### isExecutorAssigned

          public boolean isExecutorAssigned​(ExecutorDetails executor)

      Description copied from interface: `SchedulerAssignment`
      Is the executor assigned or not.
      Specified by:
        `isExecutorAssigned` in interface `SchedulerAssignment`
      Parameters:
        `executor` - the executor to check it if is assigned.
      Returns:
        true if it is assigned else false

    - #### getTopologyId

          public String getTopologyId()

      Description copied from interface: `SchedulerAssignment`
      Return the ID of the topology.
      Specified by:
        `getTopologyId` in interface `SchedulerAssignment`
      Returns:
        the topology-id this assignment is for.

    - #### getExecutorToSlot

          public Map<ExecutorDetails,​WorkerSlot> getExecutorToSlot()

      Description copied from interface: `SchedulerAssignment`
      Get the map of executor to WorkerSlot.
      Specified by:
        `getExecutorToSlot` in interface `SchedulerAssignment`
      Returns:
        the executor -> slot map.

    - #### getExecutors

          public Set<ExecutorDetails> getExecutors()

      Description copied from interface: `SchedulerAssignment`
      Get the set of all executors.
      Specified by:
        `getExecutors` in interface `SchedulerAssignment`
      Returns:
        the executors covered by this assignments

    - #### getSlotToExecutors

          public Map<WorkerSlot,​Collection<ExecutorDetails>> getSlotToExecutors()

      Description copied from interface: `SchedulerAssignment`
      Get the mapping of slot to executors on that slot.
      Specified by:
        `getSlotToExecutors` in interface `SchedulerAssignment`
      Returns:
        the slot to the executors assigned to that slot.

    - #### getScheduledResources

          public Map<WorkerSlot,​WorkerResources> getScheduledResources()

      Description copied from interface: `SchedulerAssignment`
      Get the slot to resource mapping.
      Specified by:
        `getScheduledResources` in interface `SchedulerAssignment`
      Returns:
        The slot to resource mapping

    - #### setTotalSharedOffHeapNodeMemory

          public void setTotalSharedOffHeapNodeMemory​(String node,
                                                      double value)

    - #### getNodeIdToTotalSharedOffHeapNodeMemory

          public Map<String,​Double> getNodeIdToTotalSharedOffHeapNodeMemory()

      Description copied from interface: `SchedulerAssignment`
      Get the total shared off heap node memory mapping.
      Specified by:
        `getNodeIdToTotalSharedOffHeapNodeMemory` in interface `SchedulerAssignment`
      Returns:
        host to total shared off heap node memory mapping.