<commit_before>package mil.dds.anet.threads;

import java.lang.invoke.MethodHandles;
import java.time.Instant;
import mil.dds.anet.AnetObjectEngine;
import mil.dds.anet.beans.JobHistory;
import mil.dds.anet.database.JobHistoryDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class AbstractWorker implements Runnable {

  private static final Logger logger =
      LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

  private final String startMessage;
  private JobHistoryDao jobHistoryDao;

  public AbstractWorker(String startMessage) {
    this.startMessage = startMessage;
    this.jobHistoryDao = AnetObjectEngine.getInstance().getJobHistoryDao();
  }

  protected abstract void runInternal(Instant now, JobHistory jobHistory);

  @Override
  public final void run() {
    logger.debug(startMessage);
    try {
      jobHistoryDao.runInTransaction(this.getClass().getSimpleName(),
          (now, jobHistory) -> runInternal(now, jobHistory));
    } catch (Throwable e) {
      // Cannot let this thread die. Otherwise ANET will stop checking.
      logger.error("Exception in run()", e);
    }
  }

}<commit_msg>Log start and end of workers<commit_after>package mil.dds.anet.threads;

import java.lang.invoke.MethodHandles;
import java.time.Instant;
import mil.dds.anet.AnetObjectEngine;
import mil.dds.anet.beans.JobHistory;
import mil.dds.anet.database.JobHistoryDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class AbstractWorker implements Runnable {

  private static final Logger logger =
      LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

  private final String startMessage;
  private JobHistoryDao jobHistoryDao;

  public AbstractWorker(String startMessage) {
    this.startMessage = startMessage;
    this.jobHistoryDao = AnetObjectEngine.getInstance().getJobHistoryDao();
  }

  protected abstract void runInternal(Instant now, JobHistory jobHistory);

  @Override
  public final void run() {
    final String className = this.getClass().getSimpleName();
    logger.debug("Starting {}: {}", className, startMessage);
    try {
      jobHistoryDao.runInTransaction(className, (now, jobHistory) -> runInternal(now, jobHistory));
    } catch (Throwable e) {
      // Cannot let this thread die. Otherwise ANET will stop checking.
      logger.error("Exception in run()", e);
    }
    logger.debug("Ending {}", className);
  }

}
{'fraction_non_alphanumeric': 0.10340582683627411, 'fraction_numerical': 0.0016413623307345096, 'mean_word_length': 4.429844097995546, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1688625', 'n_tokens_mistral': 710, 'n_tokens_neox': 709, 'n_words': 171}