<commit_before>package at.irian.ankor.console;

import at.irian.ankor.monitor.stats.AnkorSystemStats;
import at.irian.ankor.ref.Ref;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

/**
 * @author <NAME>
 */
@SuppressWarnings("UnusedDeclaration")
public class ConsoleModelRoot {
    //private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(ConsoleModelRoot.class);

    private long totalInboundMessages = 0;
    private long totalOutboundMessages = 0;

    public ConsoleModelRoot(final Ref myRef, final AnkorSystemStats stats) {
        Executors.newScheduledThreadPool(1, new ThreadFactory() {
            @Override
            public Thread newThread(@SuppressWarnings("NullableProblems") Runnable r) {
                Thread thread = new Thread(r);
                thread.setDaemon(true);
                return thread;
            }
        }).scheduleAtFixedRate(new Runnable() {
            @Override
            public void run() {
                try {
                    totalInboundMessages = stats.switchboard().getTotalInboundMessages();
                    totalOutboundMessages = stats.switchboard().getTotalOutboundMessages();
                    myRef.signalValueChange();
                } catch (RuntimeException e) {
                    e.printStackTrace();
                }
            }
        }, 0, 1, TimeUnit.SECONDS);
    }

    public long getTotalInboundMessages() {
        return totalInboundMessages;
    }

    public void setTotalInboundMessages(long totalInboundMessages) {
        this.totalInboundMessages = totalInboundMessages;
    }<commit_msg>stress test bugfix & improvements<commit_after>package at.irian.ankor.console;

import at.irian.ankor.monitor.stats.AnkorSystemStats;
import at.irian.ankor.pattern.AnkorPatterns;
import at.irian.ankor.ref.Ref;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

/**
 * @author <NAME>
 */
@SuppressWarnings("UnusedDeclaration")
public class ConsoleModelRoot {
    //private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(ConsoleModelRoot.class);

    private long totalInboundMessages = 0;
    private long totalOutboundMessages = 0;

    public ConsoleModelRoot(final Ref myRef, final AnkorSystemStats stats) {
        Executors.newScheduledThreadPool(1, new ThreadFactory() {
            @Override
            public Thread newThread(Runnable r) {
                Thread t = new Thread(r);
                t.setDaemon(true);
                return t;
            }
        }).scheduleAtFixedRate(new Runnable() {
            @Override
            public void run() {
                try {
                    AnkorPatterns.runLater(myRef, new Runnable() {
                        @Override
                        public void run() {
                            totalInboundMessages = stats.switchboard().getTotalInboundMessages();
                            totalOutboundMessages = stats.switchboard().getTotalOutboundMessages();
                            myRef.signalValueChange();
                        }
                    });
                } catch (RuntimeException e) {
                    e.printStackTrace();
                }
            }
        }, 0, 1, TimeUnit.SECONDS);
    }

    public long getTotalInboundMessages() {
        return totalInboundMessages;
    }

    public void setTotalInboundMessages(long totalInboundMessages) {
        this.totalInboundMessages = totalInboundMessages;
    }
{'fraction_non_alphanumeric': 0.08868501529051988, 'fraction_numerical': 0.003892132332499305, 'mean_word_length': 2.1784452296819787, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4627957', 'n_tokens_mistral': 958, 'n_tokens_neox': 920, 'n_words': 181}