<commit_before>package net.johnewart.gearman.embedded;

import net.johnewart.gearman.common.Job;
import net.johnewart.gearman.common.interfaces.EngineClient;
import net.johnewart.gearman.engine.core.JobManager;
import net.johnewart.gearman.engine.queue.factories.JobQueueFactory;
import net.johnewart.gearman.engine.queue.factories.MemoryJobQueueFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EmbeddedGearmanServer {
    private final Logger LOG = LoggerFactory.getLogger(EmbeddedGearmanServer.class);

    final JobManager jobManager;

    public EmbeddedGearmanServer() {
        JobQueueFactory jobQueueFactory = new MemoryJobQueueFactory();
        jobManager = new JobManager(jobQueueFactory);
    }

    public Job submitJob(final Job job, final EngineClient client) {
        LOG.debug("Submitting job for client...");
        return jobManager.storeJobForClient(job, client);
    }

    public Job getNextJobForWorker(final EmbeddedGearmanWorker worker) {
        return jobManager.nextJobForWorker(worker);
    }

    public void markWorkerAsleep(final EmbeddedGearmanWorker worker) {
        jobManager.sleepingWorker(worker);
    }

    public void registerWorkerAbility(final EmbeddedGearmanWorker worker,
                                      final String callback) {
        jobManager.registerWorkerAbility(callback, worker);
    }

    public void completeWork(final Job job, final byte[] results) {
        jobManager.workComplete(job, results);
    }
}<commit_msg>Updated embedded server to use job handle factory<commit_after>package net.johnewart.gearman.embedded;

import net.johnewart.gearman.common.Job;
import net.johnewart.gearman.common.interfaces.EngineClient;
import net.johnewart.gearman.common.interfaces.JobHandleFactory;
import net.johnewart.gearman.engine.core.JobManager;
import net.johnewart.gearman.engine.queue.factories.JobQueueFactory;
import net.johnewart.gearman.engine.queue.factories.MemoryJobQueueFactory;
import net.johnewart.gearman.engine.util.LocalJobHandleFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EmbeddedGearmanServer {
    private final Logger LOG = LoggerFactory.getLogger(EmbeddedGearmanServer.class);

    final JobManager jobManager;
    final JobHandleFactory jobHandleFactory;

    public EmbeddedGearmanServer() {
        JobQueueFactory jobQueueFactory = new MemoryJobQueueFactory();
        jobHandleFactory = new LocalJobHandleFactory("embedded");
        jobManager = new JobManager(jobQueueFactory, jobHandleFactory);
    }

    public Job submitJob(final Job job, final EngineClient client) {
        LOG.debug("Submitting job for client...");
        return jobManager.storeJobForClient(job, client);
    }

    public Job getNextJobForWorker(final EmbeddedGearmanWorker worker) {
        return jobManager.nextJobForWorker(worker);
    }

    public void markWorkerAsleep(final EmbeddedGearmanWorker worker) {
        jobManager.sleepingWorker(worker);
    }

    public void registerWorkerAbility(final EmbeddedGearmanWorker worker,
                                      final String callback) {
        jobManager.registerWorkerAbility(callback, worker);
    }

    public void completeWork(final Job job, final byte[] results) {
        jobManager.workComplete(job, results);
    }
}
{'fraction_non_alphanumeric': 0.07942238267148015, 'fraction_numerical': 0.0012033694344163659, 'mean_word_length': 4.007530120481928, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1094606', 'n_tokens_mistral': 973, 'n_tokens_neox': 934, 'n_words': 186}