<commit_before>package org.safehaus.subutai.plugin.hadoop.impl;


import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.safehaus.subutai.common.exception.ClusterSetupException;
import org.safehaus.subutai.common.protocol.Agent;
import org.safehaus.subutai.common.protocol.ClusterSetupStrategy;
import org.safehaus.subutai.common.protocol.EnvironmentBlueprint;
import org.safehaus.subutai.common.protocol.NodeGroup;
import org.safehaus.subutai.common.protocol.PlacementStrategy;
import org.safehaus.subutai.common.settings.Common;
import org.safehaus.subutai.common.tracker.ProductOperation;
import org.safehaus.subutai.core.agent.api.AgentManager;
import org.safehaus.subutai.core.command.api.CommandRunner;
import org.safehaus.subutai.core.container.api.container.ContainerManager;
import org.safehaus.subutai.core.db.api.DBException;
import org.safehaus.subutai.core.db.api.DbManager;
import org.safehaus.subutai.core.environment.api.EnvironmentManager;
import org.safehaus.subutai.core.environment.api.helper.Environment;
import org.safehaus.subutai.core.network.api.NetworkManager;
import org.safehaus.subutai.core.tracker.api.Tracker;
import org.safehaus.subutai.plugin.common.PluginDAO;
import org.safehaus.subutai.plugin.hadoop.api.Hadoop;
import org.safehaus.subutai.plugin.hadoop.api.HadoopClusterConfig;
import org.safehaus.subutai.plugin.hadoop.api.NodeType;
import org.safehaus.subutai.plugin.hadoop.impl.operation.Adding;
import org.safehaus.subutai.plugin.hadoop.impl.operation.Deletion;
import org.safehaus.subutai.plugin.hadoop.impl.operation.Installation;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.DataNode;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.JobTracker;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.NameNode;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.SecondaryNameNode;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.TaskTracker;


public class HadoopImpl implements Hadoop {
    public static final int INITIAL_CAPACITY = 2;

    private static CommandRunner commandRunner;
    private static AgentManager agentManager;
    private DbManager dbManager;
    private static Tracker tracker;
    private static ContainerManager containerManager;
    private static NetworkManager networkManager;
    private static ExecutorService executor;
    private static EnvironmentManager environmentManager;
    private static PluginDAO pluginDAO;


    public HadoopImpl( AgentManager agentManager, Tracker tracker, CommandRunner commandRunner, DbManager dbManager,
                       NetworkManager networkManager, ContainerManager containerManager,
                       EnvironmentManager environmentManager ) {

        HadoopImpl.agentManager = agentManager;
        HadoopImpl.tracker = tracker;
        HadoopImpl.commandRunner = commandRunner;

        HadoopImpl.networkManager = networkManager;
        HadoopImpl.containerManager = containerManager;
        HadoopImpl.environmentManager = environmentManager;
        this.dbManager = dbManager;
        HadoopImpl.pluginDAO = new PluginDAO( dbManager );
    }


    public static void init() {
        executor = Executors.newCachedThreadPool();
    }


    public static void destroy() {
        executor.shutdown();
        commandRunner = null;
    }


    public static CommandRunner getCommandRunner() {
        return commandRunner;
    }


    public static Tracker getTracker() {
        return tracker;<commit_msg>Testing null pointer in HadoopImpl getCluster()<commit_after>package org.safehaus.subutai.plugin.hadoop.impl;


import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.safehaus.subutai.common.exception.ClusterSetupException;
import org.safehaus.subutai.common.protocol.Agent;
import org.safehaus.subutai.common.protocol.ClusterSetupStrategy;
import org.safehaus.subutai.common.protocol.EnvironmentBlueprint;
import org.safehaus.subutai.common.protocol.NodeGroup;
import org.safehaus.subutai.common.protocol.PlacementStrategy;
import org.safehaus.subutai.common.settings.Common;
import org.safehaus.subutai.common.tracker.ProductOperation;
import org.safehaus.subutai.core.agent.api.AgentManager;
import org.safehaus.subutai.core.command.api.CommandRunner;
import org.safehaus.subutai.core.container.api.container.ContainerManager;
import org.safehaus.subutai.core.db.api.DBException;
import org.safehaus.subutai.core.db.api.DbManager;
import org.safehaus.subutai.core.environment.api.EnvironmentManager;
import org.safehaus.subutai.core.environment.api.helper.Environment;
import org.safehaus.subutai.core.network.api.NetworkManager;
import org.safehaus.subutai.core.tracker.api.Tracker;
import org.safehaus.subutai.plugin.common.PluginDAO;
import org.safehaus.subutai.plugin.hadoop.api.Hadoop;
import org.safehaus.subutai.plugin.hadoop.api.HadoopClusterConfig;
import org.safehaus.subutai.plugin.hadoop.api.NodeType;
import org.safehaus.subutai.plugin.hadoop.impl.operation.Adding;
import org.safehaus.subutai.plugin.hadoop.impl.operation.Deletion;
import org.safehaus.subutai.plugin.hadoop.impl.operation.Installation;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.DataNode;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.JobTracker;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.NameNode;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.SecondaryNameNode;
import org.safehaus.subutai.plugin.hadoop.impl.operation.configuration.TaskTracker;

import com.google.common.base.Preconditions;


public class HadoopImpl implements Hadoop {
    public static final int INITIAL_CAPACITY = 2;

    private static CommandRunner commandRunner;
    private static AgentManager agentManager;
    private static Tracker tracker;
    private static ContainerManager containerManager;
    private static NetworkManager networkManager;
    private static ExecutorService executor;
    private static EnvironmentManager environmentManager;
    private static PluginDAO pluginDAO;


    public HadoopImpl( AgentManager agentManager, Tracker tracker, CommandRunner commandRunner, DbManager dbManager,
                       NetworkManager networkManager, ContainerManager containerManager,
                       EnvironmentManager environmentManager ) {

        Preconditions.checkNotNull( commandRunner, "Command Runner is null" );
        Preconditions.checkNotNull( agentManager, "Agent Manager is null" );
        Preconditions.checkNotNull( dbManager, "Db Manager is null" );
        Preconditions.checkNotNull( tracker, "Tracker is null" );
        Preconditions.checkNotNull( containerManager, "Container manager is null" );
        Preconditions.checkNotNull( environmentManager, "Environment manager is null" );

        HadoopImpl.agentManager = agentManager;
        HadoopImpl.tracker = tracker;
        HadoopImpl.commandRunner = commandRunner;
        HadoopImpl.networkManager = networkManager;
        HadoopImpl.containerManager = containerManager;
        HadoopImpl.environmentManager = environmentManager;
        HadoopImpl.pluginDAO = new PluginDAO( dbManager );
    }


    public static void init() {
        executor = Executors.newCachedThreadPool();
    }


    public static void destroy() {
        executor.shutdown();
        commandRunner = null;
    }


    public static CommandRunner getCommandRunner() {
        return commandRunner;
    }


    public static Tracker getTracker() {
        return tracker;
{'fraction_non_alphanumeric': 0.08601469470483912, 'fraction_numerical': 0.0002533569799847986, 'mean_word_length': 4.635260528194147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1226104', 'n_tokens_mistral': 2254, 'n_tokens_neox': 2171, 'n_words': 394}