mirror of https://github.com/apache/kafka.git
MINOR: Clean up of SourceTaskOffsetCommiter
Author: Liquan Pei <liquanpei@gmail.com> Reviewers: Ewen Cheslack-Postava <ewen@confluent.io> Closes #1170 from Ishiihara/minor-cleanup
This commit is contained in:
parent
3a20ba3055
commit
83cf38545b
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.apache.kafka.connect.runtime;
|
||||
|
||||
import org.apache.kafka.common.utils.Time;
|
||||
import org.apache.kafka.connect.errors.ConnectException;
|
||||
import org.apache.kafka.connect.util.ConnectorTaskId;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -45,13 +44,11 @@ import java.util.concurrent.TimeUnit;
|
|||
class SourceTaskOffsetCommitter {
|
||||
private static final Logger log = LoggerFactory.getLogger(SourceTaskOffsetCommitter.class);
|
||||
|
||||
private Time time;
|
||||
private WorkerConfig config;
|
||||
private ScheduledExecutorService commitExecutorService = null;
|
||||
private HashMap<ConnectorTaskId, ScheduledCommitTask> committers = new HashMap<>();
|
||||
private final HashMap<ConnectorTaskId, ScheduledCommitTask> committers = new HashMap<>();
|
||||
|
||||
SourceTaskOffsetCommitter(Time time, WorkerConfig config) {
|
||||
this.time = time;
|
||||
SourceTaskOffsetCommitter(WorkerConfig config) {
|
||||
this.config = config;
|
||||
commitExecutorService = Executors.newSingleThreadScheduledExecutor();
|
||||
}
|
||||
|
@ -96,7 +93,7 @@ class SourceTaskOffsetCommitter {
|
|||
}
|
||||
}
|
||||
|
||||
public void commit(ConnectorTaskId id, WorkerSourceTask workerTask) {
|
||||
private void commit(ConnectorTaskId id, WorkerSourceTask workerTask) {
|
||||
final ScheduledCommitTask task;
|
||||
synchronized (committers) {
|
||||
task = committers.get(id);
|
||||
|
|
|
@ -120,7 +120,7 @@ public class Worker {
|
|||
producer = new KafkaProducer<>(producerProps);
|
||||
|
||||
offsetBackingStore.start();
|
||||
sourceTaskOffsetCommitter = new SourceTaskOffsetCommitter(time, config);
|
||||
sourceTaskOffsetCommitter = new SourceTaskOffsetCommitter(config);
|
||||
|
||||
log.info("Worker started");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue