@Override
    public int logicalDeleteByProcessorFilterId(final int processorFilterId) {
        final int count = JooqUtil.withDeadlockRetries(
                () ->
                        JooqUtil.contextResult(processorDbConnProvider, context -> context
                                .update(PROCESSOR_TASK)
                                .set(PROCESSOR_TASK.STATUS, TaskStatus.DELETED.getPrimitiveValue())
                                .set(PROCESSOR_TASK.VERSION, PROCESSOR_TASK.VERSION.plus(1))
                                .set(PROCESSOR_TASK.STATUS_TIME_MS, Instant.now().toEpochMilli())
                                .where(PROCESSOR_TASK.FK_PROCESSOR_FILTER_ID.eq(processorFilterId))
                                .and(PROCESSOR_TASK.STATUS.notIn(
                                        TaskStatus.DELETED.getPrimitiveValue(),
                                        TaskStatus.COMPLETE.getPrimitiveValue(),
                                        TaskStatus.FAILED.getPrimitiveValue()))
                                .execute()),
                () -> "");

        LOGGER.debug("Logically deleted {} processor tasks", count);
        return count;
    }
Count the current number of tasks for a filter matching the specified status.

@param filterId The filter to count tasks for.
@param status   Task status.
@return The number of tasks matching the specified status.
stroom-processor/stroom-processor-impl-db/src/main/java/stroom/processor/impl/db/ProcessorTaskDaoImpl.java