Skip to content

Commit 663883b

Browse files
authored
Merge pull request #23 from wy96f/schedule_fetch_on_start
Schedule fetch on start
2 parents 49ba105 + e4e66dc commit 663883b

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

src/main/java/com/comcast/kafka/connect/kafka/PartitionMonitor.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -120,28 +120,9 @@ public void run() {
120120
}
121121

122122
public void start() {
123-
// On start, block until we retrieve the initial list of topic partitions (or at
124-
// least until timeout)
125-
try {
126-
// This will block while waiting to retrieve data form kafka. Timeout is set so
127-
// that we don't hang the kafka connect herder if an invalid configuration
128-
// causes us to retry infinitely.
129-
logger.info("Retrieving initial topic list from kafka.");
130-
setCurrentLeaderTopicPartitions(retrieveLeaderTopicPartitions(topicRequestTimeoutMs));
131-
} catch (TimeoutException e) {
132-
logger.error(
133-
"Timeout while waiting for AdminClient to return topic list. This likely indicates a (possibly transient) connection issue, but could be an indicator that the timeout is set too low. {}",
134-
e);
135-
} catch (ExecutionException e) {
136-
logger.error("Unexpected ExecutionException. {}", e);
137-
throw new ConnectException("Unexpected while starting PartitionMonitor.");
138-
} catch (InterruptedException e) {
139-
logger.error("InterruptedException. {}, e");
140-
throw new ConnectException("Unexpected InterruptedException while starting PartitionMonitor.");
141-
}
142123
// Schedule a task to periodically run to poll for new data
143124
pollExecutorService = Executors.newSingleThreadScheduledExecutor();
144-
pollHandle = pollExecutorService.scheduleWithFixedDelay(pollThread, topicPollIntervalMs, topicPollIntervalMs,
125+
pollHandle = pollExecutorService.scheduleWithFixedDelay(pollThread, 0, topicPollIntervalMs,
145126
TimeUnit.MILLISECONDS);
146127
}
147128

0 commit comments

Comments
 (0)