<commit_before>package de.otto.edison.status.indicator;

import de.otto.edison.status.domain.ApplicationStatus;
import de.otto.edison.status.domain.VersionInfo;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;

import static de.otto.edison.status.domain.ApplicationStatus.applicationStatus;
import static java.net.InetAddress.getLocalHost;
import static java.util.Collections.unmodifiableList;
import static java.util.stream.Collectors.toList;

/**
 * @author <NAME>
 * @since 13.02.15
 */
public class CachedApplicationStatusAggregator implements ApplicationStatusAggregator {

    private volatile ApplicationStatus cachedStatus;

    private final String applicationName;
    private final VersionInfo versionInfo;
    private final List<StatusDetailIndicator> indicators;
    private final String hostName;

    public CachedApplicationStatusAggregator(final String applicationName,
                                             final VersionInfo versionInfo,
                                             final List<StatusDetailIndicator> indicators) {
        this.applicationName = applicationName;
        this.versionInfo = versionInfo;
        this.indicators = unmodifiableList(new ArrayList<>(indicators));
        this.hostName = hostName();
        this.cachedStatus = calcApplicationStatus();
    }

    @Override
    public ApplicationStatus aggregatedStatus() {
        return cachedStatus;
    }

    @Override
    public void update() {
        System.out.println("updating...");
        this.cachedStatus = calcApplicationStatus();
    }

    private ApplicationStatus calcApplicationStatus() {
        return applicationStatus(applicationName, hostName, versionInfo, indicators
                        .stream()
                        .map(StatusDetailIndicator::statusDetail)
                        .collect(toList())
        );
    }

    private String hostName() {
        try {
            final String envHost = System.getenv("HOST");
            if (envHost != null) {
                return envHost;
            } else {
                return getLocalHost().getHostName();
            }
        } catch (final UnknownHostException e) {
            return "UNKOWN";
        }<commit_msg>Removed call to System.out<commit_after>package de.otto.edison.status.indicator;

import de.otto.edison.status.domain.ApplicationStatus;
import de.otto.edison.status.domain.VersionInfo;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;

import static de.otto.edison.status.domain.ApplicationStatus.applicationStatus;
import static java.net.InetAddress.getLocalHost;
import static java.util.Collections.unmodifiableList;
import static java.util.stream.Collectors.toList;

/**
 * @author <NAME>
 * @since 13.02.15
 */
public class CachedApplicationStatusAggregator implements ApplicationStatusAggregator {

    private volatile ApplicationStatus cachedStatus;

    private final String applicationName;
    private final VersionInfo versionInfo;
    private final List<StatusDetailIndicator> indicators;
    private final String hostName;

    public CachedApplicationStatusAggregator(final String applicationName,
                                             final VersionInfo versionInfo,
                                             final List<StatusDetailIndicator> indicators) {
        this.applicationName = applicationName;
        this.versionInfo = versionInfo;
        this.indicators = unmodifiableList(new ArrayList<>(indicators));
        this.hostName = hostName();
        this.cachedStatus = calcApplicationStatus();
    }

    @Override
    public ApplicationStatus aggregatedStatus() {
        return cachedStatus;
    }

    @Override
    public void update() {
        this.cachedStatus = calcApplicationStatus();
    }

    private ApplicationStatus calcApplicationStatus() {
        return applicationStatus(applicationName, hostName, versionInfo, indicators
                        .stream()
                        .map(StatusDetailIndicator::statusDetail)
                        .collect(toList())
        );
    }

    private String hostName() {
        try {
            final String envHost = System.getenv("HOST");
            if (envHost != null) {
                return envHost;
            } else {
                return getLocalHost().getHostName();
            }
        } catch (final UnknownHostException e) {
            return "UNKOWN";
        }
{'fraction_non_alphanumeric': 0.08124174372523117, 'fraction_numerical': 0.002642007926023778, 'mean_word_length': 2.5409197194076385, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6965810', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1077, 'n_words': 246}