private void deleteDuplicateOutput(final Meta meta,
                                       final Processor processor) {
        final AtomicInteger count = new AtomicInteger();
        try {
            final ExpressionOperator findMetaExpression = ExpressionOperator.builder()
                    .addIdTerm(MetaFields.PARENT_ID, Condition.EQUALS, meta.getId())
                    .addDocRefTerm(MetaFields.PIPELINE, Condition.IS_DOC_REF, processor.getPipeline())
                    .addOperator(
                            ExpressionOperator
                                    .builder()
                                    .op(Op.OR)
                                    .addTextTerm(MetaFields.STATUS, Condition.EQUALS, Status.LOCKED.toString())
                                    .addTextTerm(MetaFields.STATUS, Condition.EQUALS, Status.UNLOCKED.toString())
                                    .build())
                    .build();
            final FindMetaCriteria findMetaCriteria = new FindMetaCriteria(findMetaExpression);
            final List<Meta> streamList = metaService.find(findMetaCriteria).getValues();

            Map<Long, ProcessorTask> taskMap = null;
            if (streamList != null && streamList.size() > 0) {
                for (final Meta oldMeta : streamList) {
                    try {
                        if (oldMeta.getProcessorTaskId() == null) {
                            metaService.updateStatus(oldMeta, oldMeta.getStatus(), Status.DELETED);
                            count.incrementAndGet();
                        } else if (oldMeta.getProcessorTaskId() != processorTask.getId()) {
                            if (taskMap == null) {
                                final ExpressionOperator findTaskExpression = ExpressionOperator.builder()
                                        .addIdTerm(ProcessorTaskFields.META_ID, Condition.EQUALS, meta.getId())
                                        .addIdTerm(
                                                ProcessorTaskFields.PROCESSOR_ID, Condition.EQUALS, processor.getId())
                                        .build();
                                final ResultPage<ProcessorTask> tasks = processorTaskService.find(
                                        new ExpressionCriteria(findTaskExpression));
                                taskMap = tasks
                                        .stream()
                                        .collect(Collectors.toMap(ProcessorTask::getId, Function.identity()));
                            }

                            final ProcessorTask task = taskMap.get(oldMeta.getProcessorTaskId());
                            if (task == null ||
                                TaskStatus.COMPLETE.equals(task.getStatus()) ||
                                TaskStatus.DELETED.equals(task.getStatus())) {
                                // If the task associated with the other output is complete in some way then delete the
                                // output.
                                metaService.updateStatus(oldMeta, oldMeta.getStatus(), Status.DELETED);
                                count.incrementAndGet();
                            }
                        }
                    } catch (final RuntimeException e) {
                        LOGGER.error(e::getMessage, e);
                    }
                }
            }
        } catch (final RuntimeException e) {
            LOGGER.error(e::getMessage, e);
        }

        if (count.get() > 0) {
            LOGGER.info(() -> "Deleted " + count.get() + " duplicates");
        }
    }
Used to handle any errors that may occur during translation.
stroom-core/src/main/java/stroom/core/dataprocess/AbstractProcessorTaskExecutor.java