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

Aias00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 43e05e91fe fix: MemorySafeLinkedBlockingQueue.put rejects after 
successful enqueue (#6455)
43e05e91fe is described below

commit 43e05e91fe2149a2695a0f3e048b71f82945783d
Author: hengyuss <[email protected]>
AuthorDate: Tue Jul 28 11:48:10 2026 +0800

    fix: MemorySafeLinkedBlockingQueue.put rejects after successful enqueue 
(#6455)
    
    Co-authored-by: aias00 <[email protected]>
---
 .../shenyu/common/concurrent/MemorySafeLinkedBlockingQueue.java    | 7 ++++---
 .../main/java/org/apache/shenyu/common/concurrent/Rejector.java    | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/MemorySafeLinkedBlockingQueue.java
 
b/shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/MemorySafeLinkedBlockingQueue.java
index 6eff9a4fd0..ee9e6b8bbe 100644
--- 
a/shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/MemorySafeLinkedBlockingQueue.java
+++ 
b/shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/MemorySafeLinkedBlockingQueue.java
@@ -87,10 +87,11 @@ public class MemorySafeLinkedBlockingQueue<E> extends 
LinkedBlockingQueue<E> {
 
     @Override
     public void put(final E e) throws InterruptedException {
-        if (hasRemainedMemory()) {
-            super.put(e);
+        if (!hasRemainedMemory()) {
+            rejector.reject(e, this);
+            return;
         }
-        rejector.reject(e, this);
+        super.put(e);
     }
 
     @Override
diff --git 
a/shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/Rejector.java 
b/shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/Rejector.java
index 386549812c..f1ec340e04 100644
--- 
a/shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/Rejector.java
+++ 
b/shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/Rejector.java
@@ -31,7 +31,7 @@ public interface Rejector<E> {
 
     /**
      * Method that may be invoked by a {@link MemorySafeLinkedBlockingQueue} 
when
-     * {@link MemorySafeLinkedBlockingQueue#hasRemainedMemory} return true.
+     * {@link MemorySafeLinkedBlockingQueue#hasRemainedMemory} return false.
      * This may occur when no more memory are available because their bounds 
would be exceeded.
      *
      * <p>In the absence of other alternatives, the method may throw an 
unchecked

Reply via email to