Skip to content

Commit

Permalink
Use fully constructed confirmationWindow instead of testing for null
Browse files Browse the repository at this point in the history
    On advice, removed the null test and replaced it with an initializer.
    Also removed unnecessary property declaration in pom.
  • Loading branch information
Derrick Oswald authored and castorm committed Dec 26, 2020
1 parent e4cbbd2 commit a8751e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 0 additions & 4 deletions kafka-connect-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
<artifactId>kafka-connect-http</artifactId>
<name>Kafka Connect HTTP</name>

<properties>
<env.GPG_PASSPHRASE>bogus</env.GPG_PASSPHRASE>
</properties>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.function.Function;

import static com.github.castorm.kafka.connect.common.VersionUtils.getVersion;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toList;
Expand All @@ -66,7 +67,7 @@ public class HttpSourceTask extends SourceTask {

private SourceRecordFilterFactory recordFilterFactory;

private ConfirmationWindow<Map<String, ?>> confirmationWindow;
private ConfirmationWindow<Map<String, ?>> confirmationWindow = new ConfirmationWindow<>(emptyList());

@Getter
private Offset offset;
Expand Down Expand Up @@ -141,8 +142,6 @@ public void commitRecord(SourceRecord record, RecordMetadata metadata) {

@Override
public void commit() {
if (null == confirmationWindow)
return;
offset = confirmationWindow.getLowWatermarkOffset()
.map(Offset::of)
.orElse(offset);
Expand Down

0 comments on commit a8751e8

Please sign in to comment.