code: private void assignThreadsToQueues() {
      int countOfQueues = jobQueues.size();
      String[] queues = (String[]) jobQueues.keySet().toArray(
          new String[countOfQueues]);
      int numberOfQueuesPerThread = countOfQueues / poolSize;
      int numberOfQueuesAssigned = 0;
      for (int i = 0; i < poolSize; i++) {
        JobInitializationThread initializer = createJobInitializationThread();
        int batch = (i * numberOfQueuesPerThread);
        for (int j = batch; j < (batch + numberOfQueuesPerThread); j++) {
          initializer.addQueue(queues[j]);
          threadsToQueueMap.put(queues[j], initializer);
          numberOfQueuesAssigned++;
        }
      }
  
      if (numberOfQueuesAssigned < countOfQueues) {
        // Assign remaining queues in round robin fashion to other queues
        int startIndex = 0;
        for (int i = numberOfQueuesAssigned; i < countOfQueues; i++) {
          JobInitializationThread t = threadsToQueueMap
              .get(queues[startIndex]);
          t.addQueue(queues[i]);
          threadsToQueueMap.put(queues[i], t);
          startIndex++;
        }
      }
    }
docs: Method which is used by the poller to assign appropriate worker thread
  to a queue. The number of threads would be always less than or equal
  to number of queues in a system. If number of threads is configured to
  be more than number of queues then poller does not create threads more
  than number of queues.