<commit_before>/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.logserver;

import alluxio.util.CommonUtils;
import alluxio.util.WaitForOptions;

import org.apache.log4j.Hierarchy;
import org.apache.log4j.Level;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.spi.LoggerRepository;
import org.apache.log4j.spi.RootLogger;

import com.google.common.base.Function;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.NumberFormatException;
import java.net.*;
import java.util.HashMap;
import java.util.Properties;

/**
 * A centralized log server for Alluxio
 *
 * Alluxio masters and workers generate logs and store the logs in local storage. {@link AlluxioLogServerProcess}
 * allows masters and workers to "push" their logs to a centralized log server where another copy of the logs will
 * be stored.
 */
public class AlluxioLogServerProcess implements LogServerProcess {
  private ServerSocket mServerSocket;
  private int mPort;
  private String mBaseLogDir;
  private HashMap<InetAddress, Hierarchy> mInetAddressHashMap;
  private boolean mStopped;

  public AlluxioLogServerProcess(String portStr, String baseLogDir) throws NumberFormatException, IOException {
    mPort = Integer.parseInt(portStr);
    mBaseLogDir = baseLogDir;
    mServerSocket = new ServerSocket(mPort);
    mInetAddressHashMap = new HashMap<>();
    mStopped = false;
  }
  /**
   * Starts the Alluxio process. This call blocks until the process is stopped via
   * {@link #stop()}. The {@link #waitForReady()} method can be used to make sure that the
   * process is ready to serve requests.
   */
  @Override<commit_msg>Remove import java.net.*<commit_after>/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.logserver;

import alluxio.util.CommonUtils;
import alluxio.util.WaitForOptions;

import org.apache.log4j.Hierarchy;
import org.apache.log4j.Level;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.spi.LoggerRepository;
import org.apache.log4j.spi.RootLogger;

import com.google.common.base.Function;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.NumberFormatException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Properties;

/**
 * A centralized log server for Alluxio
 *
 * Alluxio masters and workers generate logs and store the logs in local storage. {@link AlluxioLogServerProcess}
 * allows masters and workers to "push" their logs to a centralized log server where another copy of the logs will
 * be stored.
 */
public class AlluxioLogServerProcess implements LogServerProcess {
  private ServerSocket mServerSocket;
  private int mPort;
  private String mBaseLogDir;
  private HashMap<InetAddress, Hierarchy> mInetAddressHashMap;
  private boolean mStopped;

  public AlluxioLogServerProcess(String portStr, String baseLogDir) throws NumberFormatException, IOException {
    mPort = Integer.parseInt(portStr);
    mBaseLogDir = baseLogDir;
    mServerSocket = new ServerSocket(mPort);
    mInetAddressHashMap = new HashMap<>();
    mStopped = false;
  }
  /**
   * Starts the Alluxio process. This call blocks until the process is stopped via
   * {@link #stop()}. The {@link #waitForReady()} method can be used to make sure that the
   * process is ready to serve requests.
   */
  @Override
{'fraction_non_alphanumeric': 0.078971119133574, 'fraction_numerical': 0.004061371841155234, 'mean_word_length': 4.590163934426229, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5630010', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1242, 'n_words': 457}