You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/04/28 06:59:06 UTC

[GitHub] [camel] essobedo commented on a diff in pull request #7503: CAMEL-18019: ensure some fields in the Kafka record fetcher are safe for concurrent read

essobedo commented on code in PR #7503:
URL: https://github.com/apache/camel/pull/7503#discussion_r860547126


##########
components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaFetchRecords.java:
##########
@@ -516,28 +520,23 @@ public boolean isReady() {
         return ready;
     }
 
-    Properties getKafkaProps() {
+    private Properties getKafkaProps() {
         return kafkaProps;
     }
 
-    String getClientId() {
-        return clientId;
-    }
-
-    Exception getLastError() {
-        return lastError;
-    }
-
-    boolean isTerminated() {
+    private boolean isTerminated() {
         return terminated;
     }
 
-    boolean isRecoverable() {
+    private boolean isRecoverable() {
         return (pollExceptionStrategy.canContinue() || isReconnect()) && isKafkaConsumerRunnable();
     }
 
-    long getCurrentRecoveryInterval() {
-        return currentBackoffInterval;
+    // concurrent access happens here
+    public TaskHealthState healthState() {

Review Comment:
   private package instead of public as it seems to be an implementation detail?



##########
components/camel-kafka/src/main/java/org/apache/camel/component/kafka/TaskHealthState.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kafka;
+
+import java.util.Properties;
+
+import org.apache.camel.util.TimeUtils;
+import org.apache.kafka.clients.consumer.ConsumerConfig;
+
+/*
+ * This one is used to avoid exposing methods from this class to the health checker. Fields and methods used
+ * used to build an instance of this class, must be made thread-safe (i.e.: most importantly, read fields
+ * should be marked as volatile).
+ */
+public class TaskHealthState {

Review Comment:
   private package instead of public as it seems to be an implementation detail?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org