final ExecutorService executor = Threads.newFixedThreadPool(MongoDbConnector.class, taskContext.serverName(), "replicator", numThreads); AtomicInteger stillRunning = new AtomicInteger(numThreads); logger.info("Ignoring unnamed replica sets: {}", replicaSets.unnamedReplicaSets());
/** * @param context the replication context; may not be null * @param replicaSet the replica set to be replicated; may not be null * @param recorder the recorder for source record produced by this replicator; may not be null * @param onFailure listener of exceptions thrown by replicator task */ public Replicator(MongoDbTaskContext context, ReplicaSet replicaSet, BlockingConsumer<SourceRecord> recorder, Consumer<Throwable> onFailure) { assert context != null; assert replicaSet != null; assert recorder != null; this.context = context; this.source = context.source(); this.replicaSet = replicaSet; this.rsName = replicaSet.replicaSetName(); final String copyThreadName = "copy-" + (replicaSet.hasReplicaSetName() ? replicaSet.replicaSetName() : "main"); this.copyThreads = Threads.newFixedThreadPool(MongoDbConnector.class, context.serverName(), copyThreadName, context.getConnectionContext().maxNumberOfCopyThreads()); this.bufferedRecorder = new BufferableRecorder(recorder); this.recordMakers = new RecordMakers(context.filters(), this.source, context.topicSelector(), this.bufferedRecorder, context.isEmitTombstoneOnDelete()); this.clock = this.context.getClock(); this.onFailure = onFailure; }