class DynamicFilterService {

    public void stageCannotScheduleMoreTasks(StageId stageId, int numberOfTasks)
    {
        DynamicFilterContext context = dynamicFilterContexts.get(stageId.getQueryId());
        if (context == null) {
            // query has been removed
            return;
        }

        context.stageCannotScheduleMoreTasks(stageId, numberOfTasks);
        executor.submit(() -> collectDynamicFilters(stageId, Optional.empty()));
    }

    @Inject public  DynamicFilterService(DynamicFilterConfig dynamicFilterConfig);
    @VisibleForTesting public  DynamicFilterService(ExecutorService executor);

}