<commit_before>package org.lapanen.stealth.si.process;

import java.util.concurrent.ExecutorService;

import org.springframework.integration.context.IntegrationObjectSupport;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.endpoint.MessageProducerSupport;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;

public class ProcessInboundChannelAdapter implements MessageSource<ProcessRunResult> {

    private final ProcessExecutor processExecutor;

    private final ExecutorService executorService;

    private final ExitValueResultHandler exitValueResultHandler;

    public ProcessInboundChannelAdapter(final ProcessExecutor processExecutor, final ExecutorService executorService,
            final ExitValueResultHandler exitValueResultHandler) {
        this.processExecutor = processExecutor;
        this.executorService = executorService;
        this.exitValueResultHandler = exitValueResultHandler;
    }
    public ProcessInboundChannelAdapter(final ProcessExecutor processExecutor, final ExecutorService executorService) {
        this(processExecutor, executorService, new OnNokExitValueExceptionThrowingExitValueHandler());
    }

    @Override
    public Message<ProcessRunResult> receive() {
        return MessageBuilder.withPayload(processExecutor.execute(executorService)).build();
    }
}<commit_msg>Add result handling to the adapter -- now for real, actually.<commit_after>package org.lapanen.stealth.si.process;

import java.util.concurrent.ExecutorService;

import org.springframework.integration.context.IntegrationObjectSupport;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.endpoint.MessageProducerSupport;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;

public class ProcessInboundChannelAdapter implements MessageSource<ProcessRunResult> {

    private final ProcessExecutor processExecutor;

    private final ExecutorService executorService;

    private final ExitValueResultHandler exitValueResultHandler;

    public ProcessInboundChannelAdapter(final ProcessExecutor processExecutor, final ExecutorService executorService,
            final ExitValueResultHandler exitValueResultHandler) {
        this.processExecutor = processExecutor;
        this.executorService = executorService;
        this.exitValueResultHandler = exitValueResultHandler;
    }
    public ProcessInboundChannelAdapter(final ProcessExecutor processExecutor, final ExecutorService executorService) {
        this(processExecutor, executorService, new OnNokExitValueExceptionThrowingExitValueHandler());
    }

    @Override
    public Message<ProcessRunResult> receive() {
        final ProcessRunResult result = exitValueResultHandler.handleResult(processExecutor.execute(executorService));
        return MessageBuilder.withPayload(result).build();
    }
}
{'fraction_non_alphanumeric': 0.061224489795918366, 'fraction_numerical': 0.0, 'mean_word_length': 5.795454545454546, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6821651', 'n_tokens_mistral': 694, 'n_tokens_neox': 668, 'n_words': 141}