@Override
    public int logicalDeleteByProcessorId(final int processorId) {
        final int count = JooqUtil.withDeadlockRetries(
                () -> JooqUtil.contextResult(processorDbConnProvider, context -> {
                    var query = 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(DSL.exists(
                                    DSL.selectZero()
                                            .from(PROCESSOR_FILTER)
                                            .innerJoin(PROCESSOR)
                                            .on(PROCESSOR_FILTER.FK_PROCESSOR_ID.eq(PROCESSOR.ID))
                                            .where(PROCESSOR.ID.eq(processorId))
                                            .and(PROCESSOR_FILTER.ID.eq(PROCESSOR_TASK.FK_PROCESSOR_FILTER_ID))))
                            .and(PROCESSOR_TASK.STATUS.notIn(
                                    TaskStatus.DELETED.getPrimitiveValue(),
                                    TaskStatus.COMPLETE.getPrimitiveValue(),
                                    TaskStatus.FAILED.getPrimitiveValue()));

                    LOGGER.trace("logicalDeleteByProcessorId query:\n{}", query);
                    return query.execute();
                }),
                () -> "Logically delete tasks for processorId: " + processorId
        );
        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