<commit_before>
package com.torodb.mongodb.repl;

import com.eightkdata.mongowp.Status;
import com.eightkdata.mongowp.server.api.oplog.OplogOperation;
import com.google.common.util.concurrent.AbstractExecutionThreadService;
import com.torodb.core.exceptions.user.UserException;
import com.torodb.core.transaction.RollbackException;
import com.torodb.mongodb.annotations.MongoDBLayer;
import com.torodb.mongodb.core.MongodConnection;
import com.torodb.mongodb.core.MongodServer;
import com.torodb.mongodb.core.WriteMongodTransaction;
import com.torodb.mongodb.repl.OplogManager.OplogManagerPersistException;
import com.torodb.mongodb.repl.OplogManager.WriteTransaction;
import java.util.List;
import java.util.concurrent.Executor;
import javax.annotation.Nonnull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 *
 */
class ReplSyncApplier extends AbstractExecutionThreadService{

    private static final Logger LOGGER = LogManager.getLogger(ReplSyncApplier.class);
    private final SyncServiceView callback;
    private final Executor executor;
    private final OplogOperationApplier oplogOpApplier;
    private final OplogManager oplogManager;
    private final MongodConnection connection;

    private volatile Thread runThread;

    ReplSyncApplier(
            @MongoDBLayer @Nonnull Executor executor,
            @Nonnull OplogOperationApplier oplogOpApplier,
            @Nonnull MongodServer server,
            @Nonnull OplogManager oplogManager,
            @Nonnull SyncServiceView callback) {
        this.callback = callback;
        this.executor = executor;
        this.connection = server.openConnection();
        this.oplogOpApplier = oplogOpApplier;
        this.oplogManager = oplogManager;
    }

    @Override
    protected String serviceName() {
        return "ToroDB Sync Applier";
    }

    @Override
    protected Executor executor() {
        return executor;
    }

    @Override
    protected void triggerShutdown() {
        if (runThread != null) {
            runThread.interrupt();
        }
    }

    @Override
    protected void run() {
        runThread = Thread.currentThread();
        while (isRunning()) {
            try (WriteTransaction oplogTransaction = oplogManager.createWriteTransaction();
                    WriteMongodTransaction transaction = connection.openWriteTransaction()) {
                try {
                    for (OplogOperation opToApply : callback.takeOps()) {
                        LOGGER.info("Executing {}", opToApply);
                        try {
                            boolean done = false;
                            while (!done) {<commit_msg>Changed oplog command execution log to trace<commit_after>
package com.torodb.mongodb.repl;

import com.eightkdata.mongowp.Status;
import com.eightkdata.mongowp.server.api.oplog.OplogOperation;
import com.google.common.util.concurrent.AbstractExecutionThreadService;
import com.torodb.core.exceptions.user.UserException;
import com.torodb.core.transaction.RollbackException;
import com.torodb.mongodb.annotations.MongoDBLayer;
import com.torodb.mongodb.core.MongodConnection;
import com.torodb.mongodb.core.MongodServer;
import com.torodb.mongodb.core.WriteMongodTransaction;
import com.torodb.mongodb.repl.OplogManager.OplogManagerPersistException;
import com.torodb.mongodb.repl.OplogManager.WriteTransaction;
import java.util.List;
import java.util.concurrent.Executor;
import javax.annotation.Nonnull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 *
 */
class ReplSyncApplier extends AbstractExecutionThreadService{

    private static final Logger LOGGER = LogManager.getLogger(ReplSyncApplier.class);
    private final SyncServiceView callback;
    private final Executor executor;
    private final OplogOperationApplier oplogOpApplier;
    private final OplogManager oplogManager;
    private final MongodConnection connection;

    private volatile Thread runThread;

    ReplSyncApplier(
            @MongoDBLayer @Nonnull Executor executor,
            @Nonnull OplogOperationApplier oplogOpApplier,
            @Nonnull MongodServer server,
            @Nonnull OplogManager oplogManager,
            @Nonnull SyncServiceView callback) {
        this.callback = callback;
        this.executor = executor;
        this.connection = server.openConnection();
        this.oplogOpApplier = oplogOpApplier;
        this.oplogManager = oplogManager;
    }

    @Override
    protected String serviceName() {
        return "ToroDB Sync Applier";
    }

    @Override
    protected Executor executor() {
        return executor;
    }

    @Override
    protected void triggerShutdown() {
        if (runThread != null) {
            runThread.interrupt();
        }
    }

    @Override
    protected void run() {
        runThread = Thread.currentThread();
        while (isRunning()) {
            try (WriteTransaction oplogTransaction = oplogManager.createWriteTransaction();
                    WriteMongodTransaction transaction = connection.openWriteTransaction()) {
                try {
                    for (OplogOperation opToApply : callback.takeOps()) {
                        LOGGER.trace("Executing {}", opToApply);
                        try {
                            boolean done = false;
                            while (!done) {
{'fraction_non_alphanumeric': 0.08057927961381359, 'fraction_numerical': 0.0007426661715558856, 'mean_word_length': 2.917818181818182, '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': '1090188', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1488, 'n_words': 298}