code: @SuppressWarnings("deprecation")
      public boolean cancelOnTargetHosts(List<String> targetHosts) {
  
          boolean success = false;
  
          try {
  
              switch (state) {
  
              case IN_PROGRESS:
                  if (executionManager != null
                          && !executionManager.isTerminated()) {
                      executionManager.tell(new CancelTaskOnHostRequest(
                              targetHosts), executionManager);
                      logger.info(
                              "asked task to stop from running on target hosts with count {}...",
                              targetHosts.size());
                  } else {
                      logger.info("manager already killed or not exist.. NO OP");
                  }
                  success = true;
                  break;
              case COMPLETED_WITHOUT_ERROR:
              case COMPLETED_WITH_ERROR:
              case WAITING:
                  logger.info("will NO OP for cancelOnTargetHost as it is not in IN_PROGRESS state");
                  success = true;
                  break;
              default:
                  break;
  
              }
  
          } catch (Exception e) {
              logger.error(
                      "cancel task {} on hosts with count {} error with exception details ",
                      this.getTaskId(), targetHosts.size(), e);
          }
  
          return success;
      }
docs: Cancel on target hosts.
  
  @param targetHosts
  the target hosts
  @return true, if successful