Search in sources :

Example 11 with PreviousContext

use of io.debezium.util.LoggingContext.PreviousContext in project debezium by debezium.

the class MongoDbConnectorTask method stop.

@Override
public void stop() {
    PreviousContext previousLogContext = this.taskContext.configureLoggingContext(taskName);
    try {
        // Signal to the 'poll()' method that it should stop what its doing ...
        if (this.running.compareAndSet(true, false)) {
            logger.info("Stopping MongoDB task");
            // Stop all running replicators ...
            Replicator replicator = null;
            int counter = 0;
            while ((replicator = this.replicators.poll()) != null) {
                replicator.stop();
                ++counter;
            }
            logger.info("Stopped MongoDB replication task by stopping {} replicator threads", counter);
        }
    } catch (Throwable e) {
        logger.error("Unexpected error shutting down the MongoDB replication task", e);
    } finally {
        previousLogContext.restore();
    }
}
Also used : PreviousContext(io.debezium.util.LoggingContext.PreviousContext)

Aggregations

PreviousContext (io.debezium.util.LoggingContext.PreviousContext)11 ArrayList (java.util.ArrayList)4 ConnectException (org.apache.kafka.connect.errors.ConnectException)4 Map (java.util.Map)3 Configuration (io.debezium.config.Configuration)2 LoggingContext (io.debezium.util.LoggingContext)2 HashMap (java.util.HashMap)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 SchemaUtil (io.debezium.data.SchemaUtil)1 VerifyRecord (io.debezium.data.VerifyRecord)1 RecordValueComparator (io.debezium.data.VerifyRecord.RecordValueComparator)1 Array (io.debezium.document.Array)1 ArrayReader (io.debezium.document.ArrayReader)1 ArrayWriter (io.debezium.document.ArrayWriter)1 Document (io.debezium.document.Document)1 DocumentReader (io.debezium.document.DocumentReader)1 Value (io.debezium.document.Value)1 CompletionCallback (io.debezium.embedded.EmbeddedEngine.CompletionCallback)1 CompletionResult (io.debezium.embedded.EmbeddedEngine.CompletionResult)1