<commit_before>package com.s24.redjob.queue;

import java.util.List;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.data.redis.connection.RedisConnectionFactory;

import com.s24.redjob.AbstractDao;
import com.s24.redjob.worker.AbstractWorkerFactoryBean;
import com.s24.redjob.worker.ExecutionRedisSerializer;

/**
 * {@link FactoryBean} for easy creation of a {@link QueueWorker}.
 */
public class QueueWorkerFactoryBean extends AbstractWorkerFactoryBean<QueueWorker> {
   /**
    * Queue dao.
    */
   private QueueDaoImpl queueDao = new QueueDaoImpl();

   /**
    * Worker thread.
    */
   private Thread thread = null;

   /**
    * Constructor.
    */
   public QueueWorkerFactoryBean() {
      super(new QueueWorker());
   }

   @Override
   public void afterPropertiesSet() throws Exception {
      queueDao.afterPropertiesSet();

      worker.setQueueDao(queueDao);

      super.afterPropertiesSet();

      thread = startThread();
   }

   /**
    * Create and start worker thread.
    */
   protected Thread startThread() {
      Thread thread = new Thread(worker, worker.getName());
      thread.start();
      return thread;
   }

   //
   // Injections.
   //

   /**
    * {@link RedisConnectionFactory} to access Redis.
    */
   public void setConnectionFactory(RedisConnectionFactory connectionFactory) {
      super.setConnectionFactory(connectionFactory);
      queueDao.setConnectionFactory(connectionFactory);
   }

   /**
    * Redis "namespace" to use. Prefix for all Redis keys. Defaults to {@value AbstractDao#DEFAULT_NAMESPACE}.
    */
   public void setNamespace(String namespace) {<commit_msg>Fix thread handling<commit_after>package com.s24.redjob.queue;

import java.util.List;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.data.redis.connection.RedisConnectionFactory;

import com.s24.redjob.AbstractDao;
import com.s24.redjob.worker.AbstractWorkerFactoryBean;
import com.s24.redjob.worker.ExecutionRedisSerializer;

/**
 * {@link FactoryBean} for easy creation of a {@link QueueWorker}.
 */
public class QueueWorkerFactoryBean extends AbstractWorkerFactoryBean<QueueWorker> {
   /**
    * Queue dao.
    */
   private QueueDaoImpl queueDao = new QueueDaoImpl();

   /**
    * Worker thread.
    */
   private Thread thread = null;

   /**
    * Constructor.
    */
   public QueueWorkerFactoryBean() {
      super(new QueueWorker());
   }

   @Override
   public void afterPropertiesSet() throws Exception {
      queueDao.afterPropertiesSet();

      worker.setQueueDao(queueDao);

      super.afterPropertiesSet();

      thread = startThread();
   }

   /**
    * Create and start worker thread.
    */
   protected Thread startThread() {
      thread = new Thread(worker, worker.getName());
      thread.start();
      return thread;
   }

   //
   // Injections.
   //

   /**
    * {@link RedisConnectionFactory} to access Redis.
    */
   public void setConnectionFactory(RedisConnectionFactory connectionFactory) {
      super.setConnectionFactory(connectionFactory);
      queueDao.setConnectionFactory(connectionFactory);
   }

   /**
    * Redis "namespace" to use. Prefix for all Redis keys. Defaults to {@value AbstractDao#DEFAULT_NAMESPACE}.
    */
   public void setNamespace(String namespace) {
{'fraction_non_alphanumeric': 0.10799396681749623, 'fraction_numerical': 0.0048265460030165915, 'mean_word_length': 3.2622107969151672, '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': '416610', 'n_tokens_mistral': 954, 'n_tokens_neox': 945, 'n_words': 205}