code: protected void freeUsed(TopologyAssignContext context) {
          Set<Integer> canFree = new HashSet<>();
          canFree.addAll(context.getAllTaskIds());
          canFree.removeAll(context.getUnstoppedTaskIds());
  
          Map<String, SupervisorInfo> cluster = context.getCluster();
          Assignment oldAssigns = context.getOldAssignment();
          for (Integer task : canFree) {
              ResourceWorkerSlot worker = oldAssigns.getWorkerByTaskId(task);
              if (worker == null) {
                  LOG.warn("No ResourceWorkerSlot of task " + task + " is found when freeing resource");
                  continue;
              }
  
              SupervisorInfo supervisorInfo = cluster.get(worker.getNodeId());
              if (supervisorInfo == null) {
                  continue;
              }
              supervisorInfo.getAvailableWorkerPorts().add(worker.getPort());
          }
      }
docs: TODO: problematic: some dead slots have been freed
  
  @param context topology assign context