You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by te...@apache.org on 2024/10/11 01:16:56 UTC
(pulsar) branch master updated: [improve][client] Add log when can't add message to the container (#21924)
This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 2dace760b03 [improve][client] Add log when can't add message to the container (#21924)
2dace760b03 is described below
commit 2dace760b03bd679dae5ea682e1e23fd93c15f78
Author: Jiwei Guo <te...@apache.org>
AuthorDate: Fri Oct 11 09:16:50 2024 +0800
[improve][client] Add log when can't add message to the container (#21924)
---
.../src/main/java/org/apache/pulsar/client/impl/MessagesImpl.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessagesImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessagesImpl.java
index d4cd36a22e1..9768fd7c74b 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessagesImpl.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessagesImpl.java
@@ -22,11 +22,13 @@ import static com.google.common.base.Preconditions.checkArgument;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import lombok.extern.slf4j.Slf4j;
import net.jcip.annotations.NotThreadSafe;
import org.apache.pulsar.client.api.Message;
import org.apache.pulsar.client.api.Messages;
@NotThreadSafe
+@Slf4j
public class MessagesImpl<T> implements Messages<T> {
private final List<Message<T>> messageList;
@@ -49,10 +51,14 @@ public class MessagesImpl<T> implements Messages<T> {
return true;
}
if (maxNumberOfMessages > 0 && currentNumberOfMessages + 1 > maxNumberOfMessages) {
+ log.warn("can't add message to the container, has exceeded the maxNumberOfMessages : {} ",
+ maxNumberOfMessages);
return false;
}
if (maxSizeOfMessages > 0 && currentSizeOfMessages + message.size() > maxSizeOfMessages) {
+ log.warn("can't add message to the container, has exceeded the maxSizeOfMessages : {} ",
+ maxSizeOfMessages);
return false;
}