This is an automated email from the ASF dual-hosted git repository.
jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new a5201b306e ARTEMIS-5733 Core bridge can lock on flow control
a5201b306e is described below
commit a5201b306e43fb94ef20cf9d7313ec706aff55ea
Author: AntonRoskvist <[email protected]>
AuthorDate: Thu Oct 30 15:17:16 2025 +0100
ARTEMIS-5733 Core bridge can lock on flow control
---
.../impl/AsynchronousProducerCreditsImpl.java | 2 +-
.../impl/AsynchronousProducerCreditsImplTest.java | 35 ++++++++++++++++++++++
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/AsynchronousProducerCreditsImpl.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/AsynchronousProducerCreditsImpl.java
index fecfe5904f..56b20a9cf7 100644
---
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/AsynchronousProducerCreditsImpl.java
+++
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/AsynchronousProducerCreditsImpl.java
@@ -66,7 +66,7 @@ public class AsynchronousProducerCreditsImpl extends
AbstractProducerCreditsImpl
}
callback.onCreditsFlow(balance <= 0, this);
- if (balance < 0 && arriving == 0) {
+ if (balance <= 0 && arriving == 0) {
// there are no more credits arriving and we are still negative,
async large message send asked too much and we need to counter balance
logger.debug("Starve credits counter balance");
int request = -balance + windowSize * 2;
diff --git
a/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/client/impl/AsynchronousProducerCreditsImplTest.java
b/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/client/impl/AsynchronousProducerCreditsImplTest.java
new file mode 100644
index 0000000000..7783894764
--- /dev/null
+++
b/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/client/impl/AsynchronousProducerCreditsImplTest.java
@@ -0,0 +1,35 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.activemq.artemis.core.client.impl;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.mockito.Mockito;
+
+public class AsynchronousProducerCreditsImplTest {
+
+ @Test
+ @Timeout(10)
+ public void testZeroCredits() throws Exception {
+ ClientSessionInternal session =
Mockito.mock(ClientSessionInternal.class);
+ AsynchronousProducerCreditsImpl producerCredits = new
AsynchronousProducerCreditsImpl(session, null, 0,
Mockito.mock(ClientProducerFlowCallback.class));
+ producerCredits.receiveCredits(0);
+ Mockito.verify(session).sendProducerCreditsMessage(0, null);
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact