code: @VisibleForTesting
      String getActiveDomain(String taskType, String[] domains) {
          if (domains == null || domains.length == 0) {
              return null;
          }
  
          return Arrays.stream(domains)
                  .filter(domain -> !domain.equalsIgnoreCase("NO_DOMAIN"))
                  .map(domain -> executionDAOFacade.getTaskPollDataByDomain(taskType, domain.trim()))
                  .filter(Objects::nonNull)
                  .filter(validateLastPolledTime)
                  .findFirst()
                  .map(PollData::getDomain)
                  .orElse(domains[domains.length - 1].trim().equalsIgnoreCase("NO_DOMAIN") ? null : domains[domains.length - 1].trim());
      }
docs: Gets the active domain from the list of domains where the task is to be queued.
  The domain list must be ordered.
  In sequence, check if any worker has polled for last `activeWorkerLastPollInSecs` seconds, if so that is the Active domain.
  When no active domains are found:
  <li> If NO_DOMAIN token is provided, return null.
  <li> Else, return last domain from list.
  
  @param taskType the taskType of the task for which active domain is to be found
  @param domains  the array of domains for the task. (Must contain atleast one element).
  @return the active domain where the task will be queued