<commit_before>package com.researchworx.cresco.controller.core;

import com.researchworx.cresco.controller.communication.*;
import com.researchworx.cresco.controller.core.*;
import com.researchworx.cresco.controller.netdiscovery.DiscoveryClientIPv4;
import com.researchworx.cresco.controller.netdiscovery.DiscoveryClientIPv6;
import com.researchworx.cresco.controller.netdiscovery.DiscoveryEngine;
import com.researchworx.cresco.controller.netdiscovery.DiscoveryType;
import com.researchworx.cresco.controller.regionalcontroller.AgentDiscovery;
import com.researchworx.cresco.controller.regionalcontroller.ControllerDB;
import com.researchworx.cresco.controller.regionalcontroller.GlobalControllerChannel;
import com.researchworx.cresco.controller.regionalcontroller.HealthWatcher;
import com.researchworx.cresco.library.core.WatchDog;
import com.researchworx.cresco.library.messaging.MsgEvent;
import com.researchworx.cresco.library.plugin.core.CPlugin;
import org.apache.activemq.command.ActiveMQDestination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;

public class Launcher extends CPlugin {
    private static final Logger LOG = LoggerFactory.getLogger(CPlugin.class);

    private String agentpath;

    private ExecutorService msgInProcessQueue;

    //regional
    private ControllerDB gdb;

    private boolean clientDiscoveryActiveIPv4 = false;
    private boolean clientDiscoveryActiveIPv6 = false;
    private boolean DiscoveryActive = false;

    private boolean ActiveBrokerManagerActive = false;
    private boolean ActiveDestManagerActive = false;

    private boolean ConsumerThreadActive = false;
    private boolean ConsumerThreadRegionActive = false;

    public boolean isRestartOnShutdown() {
        return restartOnShutdown;
    }

    public void setRestartOnShutdown(boolean restartOnShutdown) {
        this.restartOnShutdown = restartOnShutdown;
    }

    private boolean restartOnShutdown = false;

    private Thread discoveryEngineThread;

    public Thread getActiveBrokerManagerThread() {
        return activeBrokerManagerThread;
    }

    public void setActiveBrokerManagerThread(Thread activeBrokerManagerThread) {
        this.activeBrokerManagerThread = activeBrokerManagerThread;
    }

    private Thread activeBrokerManagerThread;

    public Thread getConsumerRegionThread() {
        return consumerRegionThread;
    }

    public void setConsumerRegionThread(Thread consumerRegionThread) {
        this.consumerRegionThread = consumerRegionThread;
    }

    private Thread consumerRegionThread;

    public Thread getConsumerAgentThread() {
        return consumerAgentThread;
    }

    public void setConsumerAgentThread(Thread consumerAgentThread) {
        this.consumerAgentThread = consumerAgentThread;
    }

    private Thread consumerAgentThread;
    private Thread shutdownHook;

    private ActiveProducer ap;

    private String brokerAddress;

    private boolean isRegionalController = false;
    private Map<String, Long> discoveryMap;
    private AgentDiscovery agentDiscover;

    private boolean hasGlobalController = false;
    private GlobalControllerChannel globalControllerChannel;

    private boolean isIPv6 = false;
    private boolean isActive = false;

    public AtomicInteger responds = new AtomicInteger(0);

    private ControllerConfig controllerConfig;

    private ConcurrentHashMap<String, BrokeredAgent> brokeredAgents;

    private ConcurrentLinkedQueue<MsgEvent> incomingCanidateBrokers;
    private ConcurrentLinkedQueue<MsgEvent> outgoingMessages;

    private DiscoveryClientIPv4 dcv4;
    private DiscoveryClientIPv6 dcv6;

    private ActiveBroker broker;

    private HealthWatcher healthWatcher;

    public Launcher() {
        this.msgInProcessQueue = Executors.newFixedThreadPool(4);
        this.rpcMap = new ConcurrentHashMap<>();
    }

    public void setExecutor() {
        this.setExec(new com.researchworx.cresco.controller.core.Executor(this));
    }

    public void start() {
        this.config = new ControllerConfig(this.config.getPluginConfig());
    }

    @Override
    public void msgIn(MsgEvent msg) {
        this.msgInProcessQueue.submit(new MsgRoute(this, msg));
    }

    @Override
    public void cleanUp() {
        closeCommunications();
    }

    public void closeCommunications() {<commit_msg>DiscoveryEngine : Add logger to threads<commit_after>package com.researchworx.cresco.controller.core;

import com.researchworx.cresco.controller.communication.*;
import com.researchworx.cresco.controller.core.*;
import com.researchworx.cresco.controller.netdiscovery.DiscoveryClientIPv4;
import com.researchworx.cresco.controller.netdiscovery.DiscoveryClientIPv6;
import com.researchworx.cresco.controller.netdiscovery.DiscoveryEngine;
import com.researchworx.cresco.controller.netdiscovery.DiscoveryType;
import com.researchworx.cresco.controller.regionalcontroller.AgentDiscovery;
import com.researchworx.cresco.controller.regionalcontroller.ControllerDB;
import com.researchworx.cresco.controller.regionalcontroller.GlobalControllerChannel;
import com.researchworx.cresco.controller.regionalcontroller.HealthWatcher;
import com.researchworx.cresco.library.core.WatchDog;
import com.researchworx.cresco.library.messaging.MsgEvent;
import com.researchworx.cresco.library.plugin.core.CPlugin;
import org.apache.activemq.command.ActiveMQDestination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;

public class Launcher extends CPlugin {
    private static final Logger LOG = LoggerFactory.getLogger(CPlugin.class);

    private String agentpath;

    private ExecutorService msgInProcessQueue;

    //regional
    private ControllerDB gdb;

    private boolean clientDiscoveryActiveIPv4 = false;
    private boolean clientDiscoveryActiveIPv6 = false;
    private boolean DiscoveryActive = false;

    private boolean ActiveBrokerManagerActive = false;
    private boolean ActiveDestManagerActive = false;

    private boolean ConsumerThreadActive = false;
    private boolean ConsumerThreadRegionActive = false;

    public boolean isRestartOnShutdown() {
        return restartOnShutdown;
    }

    public void setRestartOnShutdown(boolean restartOnShutdown) {
        this.restartOnShutdown = restartOnShutdown;
    }

    private boolean restartOnShutdown = false;

    private Thread discoveryEngineThread;

    public Thread getActiveBrokerManagerThread() {
        return activeBrokerManagerThread;
    }

    public void setActiveBrokerManagerThread(Thread activeBrokerManagerThread) {
        this.activeBrokerManagerThread = activeBrokerManagerThread;
    }

    private Thread activeBrokerManagerThread;

    public Thread getConsumerRegionThread() {
        return consumerRegionThread;
    }

    public void setConsumerRegionThread(Thread consumerRegionThread) {
        this.consumerRegionThread = consumerRegionThread;
    }

    private Thread consumerRegionThread;

    public Thread getConsumerAgentThread() {
        return consumerAgentThread;
    }

    public void setConsumerAgentThread(Thread consumerAgentThread) {
        this.consumerAgentThread = consumerAgentThread;
    }

    private Thread consumerAgentThread;
    private Thread shutdownHook;

    private ActiveProducer ap;

    private String brokerAddress;

    private boolean isRegionalController = false;
    private Map<String, Long> discoveryMap;
    private AgentDiscovery agentDiscover;

    private boolean hasGlobalController = false;
    private GlobalControllerChannel globalControllerChannel;

    private boolean isIPv6 = false;
    private boolean isActive = false;

    public AtomicInteger responds = new AtomicInteger(0);

    private ControllerConfig controllerConfig;

    private ConcurrentHashMap<String, BrokeredAgent> brokeredAgents;

    private ConcurrentLinkedQueue<MsgEvent> incomingCanidateBrokers;
    private ConcurrentLinkedQueue<MsgEvent> outgoingMessages;

    private DiscoveryClientIPv4 dcv4;
    private DiscoveryClientIPv6 dcv6;

    private ActiveBroker broker;

    private HealthWatcher healthWatcher;

    public Launcher() {
        this.msgInProcessQueue = Executors.newFixedThreadPool(4);
        this.rpcMap = new ConcurrentHashMap<>();
    }

    public void setExecutor() {
        this.setExec(new com.researchworx.cresco.controller.core.Executor(this));
    }

    public void start() {
        this.config = new ControllerConfig(this.config.getConfig());
    }

    @Override
    public void msgIn(MsgEvent msg) {
        this.msgInProcessQueue.submit(new MsgRoute(this, msg));
    }

    @Override
    public void cleanUp() {
        closeCommunications();
    }

    public void closeCommunications() {
{'fraction_non_alphanumeric': 0.06866537717601548, 'fraction_numerical': 0.0030088115194498175, 'mean_word_length': 4.487617924528302, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3872914', 'n_tokens_mistral': 2595, 'n_tokens_neox': 2444, 'n_words': 528}