Use AtomicInteger for numRunningTasks