You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2019/06/18 11:14:17 UTC

[qpid-broker-j] branch 7.0.x updated (45d8c4c -> 8197bd2)

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

orudyy pushed a change to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git.


    from 45d8c4c  NO-JIRA: ensure use of https for BDBJE repository
     new aa3302d  QPID-8318 : Queue.Purge does not return deleted count
     new 660363a  QPID-8316: [Broker-J] Message validation should not store decoded headers in heap
     new 763cda2  QPID-8322: [Broker-J] Fix credit restoration in window credit manager when infinite credit limit is used
     new 8197bd2  NO-JIRA: Fix NPE in conversion tests

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../qpid/server/protocol/v0_8/FieldTable.java      | 63 ++++++++++++----------
 .../apache/qpid/server/queue/AbstractQueue.java    | 11 +---
 .../server/protocol/v0_10/ConsumerTarget_0_10.java | 10 ++--
 .../server/protocol/v0_10/WindowCreditManager.java | 22 +++++---
 .../protocol/v0_10/WindowCreditManagerTest.java    | 14 +++++
 .../dependency_resolution/ClasspathQuery.java      |  7 ++-
 6 files changed, 76 insertions(+), 51 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-broker-j] 04/04: NO-JIRA: Fix NPE in conversion tests

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit 8197bd2dddef163f63efd6a2c2a9501aede5db33
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Sat Jun 15 02:10:15 2019 +0100

    NO-JIRA: Fix NPE in conversion tests
    
    (cherry picked from commit 972fe154991ad4f054aee983470da74e6ca9ab7c)
---
 .../dependency_resolution/ClasspathQuery.java                      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/systests/end-to-end-conversion-tests/src/main/java/org/apache/qpid/systests/end_to_end_conversion/dependency_resolution/ClasspathQuery.java b/systests/end-to-end-conversion-tests/src/main/java/org/apache/qpid/systests/end_to_end_conversion/dependency_resolution/ClasspathQuery.java
index 921d214..8b62a99 100644
--- a/systests/end-to-end-conversion-tests/src/main/java/org/apache/qpid/systests/end_to_end_conversion/dependency_resolution/ClasspathQuery.java
+++ b/systests/end-to-end-conversion-tests/src/main/java/org/apache/qpid/systests/end_to_end_conversion/dependency_resolution/ClasspathQuery.java
@@ -153,7 +153,12 @@ public class ClasspathQuery
 
     private String buildClassPath(final Class<?> clientClazz, final Collection<String> gavs)
     {
-        List<File> classpathElements = new ArrayList<>(_classpathCache.getUnchecked(gavs));
+        final List<File> classpathElements = new ArrayList<>();
+        final List<File> cached = _classpathCache.getUnchecked(gavs);
+        if (cached != null)
+        {
+            classpathElements.addAll(cached);
+        }
         classpathElements.add(getLocalClasspathElement(clientClazz));
 
         final String collect = classpathElements.stream()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-broker-j] 01/04: QPID-8318 : Queue.Purge does not return deleted count

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit aa3302da7dadc3a66c4a9242de829350b7f37929
Author: rgodfrey <rg...@apache.org>
AuthorDate: Mon May 27 11:26:45 2019 +0200

    QPID-8318 : Queue.Purge does not return deleted count
    
    (cherry picked from commit 9ded8dbcc69cd3ae07d095c05ad29ee6db3dfbd5)
---
 .../main/java/org/apache/qpid/server/queue/AbstractQueue.java | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java b/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
index 0275f6c..8bfee78 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
@@ -1710,20 +1710,13 @@ public abstract class AbstractQueue<X extends AbstractQueue<X>>
         while (queueListIterator.advance())
         {
             final QueueEntry node = queueListIterator.getNode();
-            boolean acquired = node.acquireOrSteal(new Runnable()
-                                                    {
-                                                        @Override
-                                                        public void run()
-                                                        {
-                                                            dequeueEntry(node);
-                                                        }
-                                                    });
+            boolean acquired = node.acquireOrSteal(() -> dequeueEntry(node));
 
             if (acquired)
             {
                 dequeueEntry(node, txn);
+                count++;
             }
-
         }
 
         txn.commit();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-broker-j] 02/04: QPID-8316: [Broker-J] Message validation should not store decoded headers in heap

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit 660363ac44a0220cbf4c3ed0f3f09c00d5428db4
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Fri Jun 14 12:43:05 2019 +0100

    QPID-8316: [Broker-J] Message validation should not store decoded headers in heap
    
    (cherry picked from commit ee225cdada7be63ea5ae7bfdaecc635bbabc3d5a)
---
 .../qpid/server/protocol/v0_8/FieldTable.java      | 63 ++++++++++++----------
 1 file changed, 36 insertions(+), 27 deletions(-)

diff --git a/broker-core/src/main/java/org/apache/qpid/server/protocol/v0_8/FieldTable.java b/broker-core/src/main/java/org/apache/qpid/server/protocol/v0_8/FieldTable.java
index 9608fc4..c1c387d 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/protocol/v0_8/FieldTable.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/protocol/v0_8/FieldTable.java
@@ -132,33 +132,39 @@ public class FieldTable
     {
         if (_encodedSize > 0)
         {
-            _properties = new LinkedHashMap<>(INITIAL_HASHMAP_CAPACITY);
+            _properties = decode();
+        }
+    }
 
-            _encodedForm.mark();
-            try
-            {
-                do
-                {
-                    final String key = AMQShortString.readAMQShortStringAsString(_encodedForm);
-                    AMQTypedValue value = AMQTypedValue.readFromBuffer(_encodedForm);
-                    _properties.put(key, value);
-                }
-                while (_encodedForm.hasRemaining());
-            }
-            finally
-            {
-                _encodedForm.reset();
-            }
+    private Map<String, AMQTypedValue> decode()
+    {
+        final Map<String, AMQTypedValue> properties = new LinkedHashMap<>(INITIAL_HASHMAP_CAPACITY);
 
-            final long recalculateEncodedSize = calculateEncodedSize();
-            if (_encodedSize != recalculateEncodedSize)
+        _encodedForm.mark();
+        try
+        {
+            do
             {
-                throw new IllegalStateException(String.format(
-                        "Malformed field table detected: provided encoded size '%d' does not equal calculated size '%d'",
-                        _encodedSize,
-                        recalculateEncodedSize));
+                final String key = AMQShortString.readAMQShortStringAsString(_encodedForm);
+                AMQTypedValue value = AMQTypedValue.readFromBuffer(_encodedForm);
+                properties.put(key, value);
             }
+            while (_encodedForm.hasRemaining());
+        }
+        finally
+        {
+            _encodedForm.reset();
+        }
+
+        final long recalculateEncodedSize = calculateEncodedSize(properties);
+        if (_encodedSize != recalculateEncodedSize)
+        {
+            throw new IllegalStateException(String.format(
+                    "Malformed field table detected: provided encoded size '%d' does not equal calculated size '%d'",
+                    _encodedSize,
+                    recalculateEncodedSize));
         }
+        return properties;
     }
 
     private AMQTypedValue setProperty(String key, AMQTypedValue val)
@@ -930,17 +936,17 @@ public class FieldTable
     private void recalculateEncodedSize()
     {
 
-        int encodedSize = calculateEncodedSize();
+        int encodedSize = calculateEncodedSize(_properties);
 
         _encodedSize = encodedSize;
     }
 
-    private int calculateEncodedSize()
+    private int calculateEncodedSize(final Map<String, AMQTypedValue> properties)
     {
         int encodedSize = 0;
-        if (_properties != null)
+        if (properties != null)
         {
-            for (Map.Entry<String, AMQTypedValue> e : _properties.entrySet())
+            for (Map.Entry<String, AMQTypedValue> e : properties.entrySet())
             {
                 encodedSize += EncodingUtils.encodedShortStringLength(e.getKey());
                 encodedSize++; // the byte for the encoding Type
@@ -1274,7 +1280,10 @@ public class FieldTable
 
     public synchronized void validate()
     {
-       clearEncodedForm();
+        if (_properties == null && _encodedForm != null && _encodedSize > 0)
+        {
+            decode();
+        }
     }
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-broker-j] 03/04: QPID-8322: [Broker-J] Fix credit restoration in window credit manager when infinite credit limit is used

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit 763cda24cf1ed63a5e093a86db7fe66f13b287a6
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Sat Jun 15 00:58:45 2019 +0100

    QPID-8322: [Broker-J] Fix credit restoration in window credit manager when infinite credit limit is used
    
    (cherry picked from commit e9f02b361a0edbd27cdf37162ed304df281d9da7)
---
 .../server/protocol/v0_10/ConsumerTarget_0_10.java | 10 ++++------
 .../server/protocol/v0_10/WindowCreditManager.java | 22 ++++++++++++++--------
 .../protocol/v0_10/WindowCreditManagerTest.java    | 14 ++++++++++++++
 3 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java b/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java
index 74c015f..fc76a79 100644
--- a/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java
+++ b/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.protocol.v0_10;
 
 import java.io.IOException;
 import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,16 +68,15 @@ public class ConsumerTarget_0_10 extends AbstractConsumerTarget<ConsumerTarget_0
     private final String _targetAddress;
 
 
-    private FlowCreditManager_0_10 _creditManager;
+    private volatile FlowCreditManager_0_10 _creditManager;
 
     private final MessageAcceptMode _acceptMode;
     private final MessageAcquireMode _acquireMode;
-    private MessageFlowMode _flowMode;
+    private volatile MessageFlowMode _flowMode;
     private final ServerSession _session;
-    private final AtomicBoolean _stopped = new AtomicBoolean(true);
 
-    private int _deferredMessageCredit;
-    private long _deferredSizeCredit;
+    private volatile int _deferredMessageCredit;
+    private volatile long _deferredSizeCredit;
 
     private final StateChangeListener<MessageInstance, EntryState> _unacknowledgedMessageListener = new StateChangeListener<MessageInstance, EntryState>()
     {
diff --git a/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/WindowCreditManager.java b/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/WindowCreditManager.java
index 3f6f086..818617b 100644
--- a/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/WindowCreditManager.java
+++ b/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/WindowCreditManager.java
@@ -63,18 +63,24 @@ public class WindowCreditManager implements FlowCreditManager_0_10
     @Override
     public synchronized void restoreCredit(final long messageCredit, final long bytesCredit)
     {
-        _messageUsed -= messageCredit;
-        if (_messageUsed < 0L)
+        if (_messageCreditLimit >= 0L)
         {
-            LOGGER.error("Message credit used value was negative: " + _messageUsed);
-            _messageUsed = 0;
+            _messageUsed -= messageCredit;
+            if (_messageUsed < 0L)
+            {
+                LOGGER.warn("Message credit used value was negative: " + _messageUsed);
+                _messageUsed = 0;
+            }
         }
 
-        _bytesUsed -= bytesCredit;
-        if (_bytesUsed < 0L)
+        if (_bytesCreditLimit >= 0L)
         {
-            LOGGER.error("Bytes credit used value was negative: " + _bytesUsed);
-            _bytesUsed = 0;
+            _bytesUsed -= bytesCredit;
+            if (_bytesUsed < 0L)
+            {
+                LOGGER.warn("Bytes credit used value was negative: " + _bytesUsed);
+                _bytesUsed = 0;
+            }
         }
     }
 
diff --git a/broker-plugins/amqp-0-10-protocol/src/test/java/org/apache/qpid/server/protocol/v0_10/WindowCreditManagerTest.java b/broker-plugins/amqp-0-10-protocol/src/test/java/org/apache/qpid/server/protocol/v0_10/WindowCreditManagerTest.java
index 1052cc5..7138715 100644
--- a/broker-plugins/amqp-0-10-protocol/src/test/java/org/apache/qpid/server/protocol/v0_10/WindowCreditManagerTest.java
+++ b/broker-plugins/amqp-0-10-protocol/src/test/java/org/apache/qpid/server/protocol/v0_10/WindowCreditManagerTest.java
@@ -90,4 +90,18 @@ public class WindowCreditManagerTest extends QpidTestCase
         assertEquals("unexpected credit value", 1, _creditManager.getMessageCredit());
         assertTrue("Manager should 'haveCredit'", _creditManager.hasCredit());
     }
+
+    public void testRestoreCreditWhenInfiniteBytesCredit()
+    {
+        _creditManager.addCredit(1, WindowCreditManager.INFINITE_CREDIT);
+
+        _creditManager.useCreditForMessage(10);
+        assertEquals(0, _creditManager.getMessageCredit());
+        assertEquals(Long.MAX_VALUE, _creditManager.getBytesCredit());
+
+        _creditManager.restoreCredit(1, 10);
+
+        assertEquals(1, _creditManager.getMessageCredit());
+        assertEquals(Long.MAX_VALUE, _creditManager.getBytesCredit());
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org