@Override public boolean isRebuilding() { String repositoryName = getRepository().getName(); return taskScheduler.listsTasks().stream() .filter(task -> RebuildBrowseNodesTaskDescriptor.TYPE_ID.equals(task.getTypeId())) .filter(task -> TaskInfo.State.RUNNING.equals(task.getCurrentState().getState())) .anyMatch(task -> { String taskRepositoryName = task.getConfiguration().getString(REPOSITORY_NAME_FIELD_ID); return taskRepositoryName.equals(repositoryName) || taskRepositoryName.equals(RepositorySelector.ALL); }); } }