Skip to content

Commit

Permalink
CAMEL-18019: ensure some fields in the Kafka record fetcher are safe …
Browse files Browse the repository at this point in the history
…for concurrent read
  • Loading branch information
orpiske committed Apr 27, 2022
1 parent 9c3aea3 commit b5361d3
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@ private enum State {
private Exception lastError;
private final KafkaConsumerListener consumerListener;

private boolean terminated;
private long currentBackoffInterval;
private boolean reconnect; // must be false at init (this is the policy whether to reconnect)
private boolean connected; // this is the state (connected or not)
// The following set of volatile variables are usually read from other threads,
// like from the health check thread. They are usually only read on those contexts.
private volatile boolean terminated;
private volatile long currentBackoffInterval;

private volatile boolean reconnect; // The reconnect must be false at init (this is the policy whether to reconnect).
private volatile boolean connected; // this is the state (connected or not)

private volatile State state = State.RUNNING;

Expand Down

0 comments on commit b5361d3

Please sign in to comment.