This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 4b9374d1865034ee3e1a6677707dbb52c2535239
Author: Otavio Rodolfo Piske <angusyo...@gmail.com>
AuthorDate: Mon Aug 8 16:16:37 2022 +0200

    (chores) camel-kafka: add log guard on resume strategy critical path
---
 .../processor/resume/kafka/SingleNodeKafkaResumeStrategy.java     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-kafka/src/main/java/org/apache/camel/processor/resume/kafka/SingleNodeKafkaResumeStrategy.java
 
b/components/camel-kafka/src/main/java/org/apache/camel/processor/resume/kafka/SingleNodeKafkaResumeStrategy.java
index 007e9d29bb7..b731e9b0c1c 100644
--- 
a/components/camel-kafka/src/main/java/org/apache/camel/processor/resume/kafka/SingleNodeKafkaResumeStrategy.java
+++ 
b/components/camel-kafka/src/main/java/org/apache/camel/processor/resume/kafka/SingleNodeKafkaResumeStrategy.java
@@ -130,7 +130,9 @@ public class SingleNodeKafkaResumeStrategy<T extends 
Resumable> implements Kafka
         OffsetKey<?> key = offset.getOffsetKey();
         Offset<?> offsetValue = offset.getLastOffset();
 
-        LOG.debug("Updating offset on Kafka with key {} to {}", 
key.getValue(), offsetValue.getValue());
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Updating offset on Kafka with key {} to {}", 
key.getValue(), offsetValue.getValue());
+        }
 
         ByteBuffer keyBuffer = key.serialize();
         ByteBuffer valueBuffer = offsetValue.serialize();
@@ -173,7 +175,9 @@ public class SingleNodeKafkaResumeStrategy<T extends 
Resumable> implements Kafka
             for (ConsumerRecord<byte[], byte[]> record : records) {
                 byte[] value = record.value();
 
-                LOG.trace("Read from Kafka: {}", value);
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Read from Kafka: {}", value);
+                }
 
                 if (!deserializable.deserialize(ByteBuffer.wrap(record.key()), 
ByteBuffer.wrap(record.value()))) {
                     LOG.warn("Deserializer indicates that this is the last 
record to deserialize");

Reply via email to