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 2018/06/07 09:14:54 UTC

qpid-broker-j git commit: QPID-8204: [Broker-J] Rename new statistics into 'inboundMessageHighWatermark' and remove extra switch enabling the statistics evaluation

Repository: qpid-broker-j
Updated Branches:
  refs/heads/master fc3555cb8 -> 0b63b074e


QPID-8204: [Broker-J] Rename new statistics into 'inboundMessageHighWatermark' and remove extra switch enabling the statistics evaluation


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/0b63b074
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/0b63b074
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/0b63b074

Branch: refs/heads/master
Commit: 0b63b074e0e61e026caab0122aa4fa404aec25ff
Parents: fc3555c
Author: Alex Rudyy <or...@apache.org>
Authored: Wed Jun 6 20:02:35 2018 +0100
Committer: Alex Rudyy <or...@apache.org>
Committed: Thu Jun 7 10:14:05 2018 +0100

----------------------------------------------------------------------
 .../java/org/apache/qpid/server/model/Broker.java  | 14 +++-----------
 .../org/apache/qpid/server/model/BrokerImpl.java   | 17 ++++++-----------
 .../server/virtualhost/AbstractVirtualHost.java    | 15 +++++----------
 .../virtualhost/QueueManagingVirtualHost.java      |  8 +++-----
 4 files changed, 17 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0b63b074/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java b/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
index 770709a..e959818 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
@@ -126,12 +126,6 @@ public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>, EventL
 
     String PROPERTY_DISABLED_FEATURES = "qpid.broker_disabled_features";
 
-    String MAX_MESSAGE_SIZE__STATISTICS_ENABLED = "qpid.broker.maxMessageSizeStatisticsEnabled";
-    @ManagedContextDefault(name = MAX_MESSAGE_SIZE__STATISTICS_ENABLED,
-                            description = "Flag to enable collection of maximum message size statistics.")
-    @SuppressWarnings("unused")
-    boolean DEFAULT_MAX_MESSAGE_SIZE_STATISTICS_ENABLED = false;
-
     @DerivedAttribute
     String getBuildVersion();
 
@@ -303,11 +297,9 @@ public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>, EventL
     @SuppressWarnings("unused")
     @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME,
             units = StatisticUnit.BYTES,
-            label = "Maximum inbound message size",
-            description = "Maximum size of messages published into the Broker since start-up."
-                          + " The statistics is only evaluated when context variable"
-                          + " 'qpid.broker.maxMessageSizeStatisticsEnabled' is set to 'true'.")
-    long getMaximumMessageSize();
+            label = "Maximum recorded size of inbound messages",
+            description = "Maximum size of messages published into the Broker since start-up.")
+    long getInboundMessageSizeHighWatermark();
 
     @ManagedOperation(nonModifying = true,
             description = "Restart the broker within the same JVM",

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0b63b074/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java b/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
index b2471d3..5f06b84 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
@@ -121,7 +121,7 @@ public class BrokerImpl extends AbstractContainer<BrokerImpl> implements Broker<
     private final AtomicLong _transactedMessagesOut = new AtomicLong();
     private final AtomicLong _bytesIn = new AtomicLong();
     private final AtomicLong _bytesOut = new AtomicLong();
-    private final AtomicLong _maximumMessageSizeIn = new AtomicLong();
+    private final AtomicLong _maximumMessageSize = new AtomicLong();
 
     @ManagedAttributeField
     private int _statisticsReportingPeriod;
@@ -146,7 +146,6 @@ public class BrokerImpl extends AbstractContainer<BrokerImpl> implements Broker<
     private ScheduledFuture<?> _assignTargetSizeSchedulingFuture;
     private volatile ScheduledFuture<?> _statisticsReportingFuture;
     private long _housekeepingCheckPeriod;
-    private volatile boolean _maximumMessageSizeStatisticsEnabled;
 
     @ManagedObjectFactoryConstructor
     public BrokerImpl(Map<String, Object> attributes,
@@ -633,7 +632,6 @@ public class BrokerImpl extends AbstractContainer<BrokerImpl> implements Broker<
         _compactMemoryThreshold = getContextValue(Long.class, Broker.COMPACT_MEMORY_THRESHOLD);
         _compactMemoryInterval = getContextValue(Long.class, Broker.COMPACT_MEMORY_INTERVAL);
         _housekeepingCheckPeriod = getContextValue(Long.class, Broker.QPID_BROKER_HOUSEKEEPING_CHECK_PERIOD);
-        _maximumMessageSizeStatisticsEnabled = getContextValue(Boolean.class, Broker.MAX_MESSAGE_SIZE__STATISTICS_ENABLED);
 
         if (SystemUtils.getProcessPid() != null)
         {
@@ -876,9 +874,10 @@ public class BrokerImpl extends AbstractContainer<BrokerImpl> implements Broker<
     {
         _messagesIn.incrementAndGet();
         _bytesIn.addAndGet(messageSize);
-        if (_maximumMessageSizeStatisticsEnabled)
+        long hwm;
+        while((hwm = _maximumMessageSize.get()) < messageSize)
         {
-           _maximumMessageSizeIn.getAndUpdate(current -> messageSize > current ? messageSize : current);
+            _maximumMessageSize.compareAndSet(hwm, messageSize);
         }
     }
 
@@ -903,13 +902,9 @@ public class BrokerImpl extends AbstractContainer<BrokerImpl> implements Broker<
     }
 
     @Override
-    public long getMaximumMessageSize()
+    public long getInboundMessageSizeHighWatermark()
     {
-        if (_maximumMessageSizeStatisticsEnabled)
-        {
-            return _maximumMessageSizeIn.get();
-        }
-        return 0;
+        return _maximumMessageSize.get();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0b63b074/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
index a15f5eb..f038ecf 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
@@ -216,7 +216,6 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
     private final AccessControl _accessControl;
 
     private volatile boolean _createDefaultExchanges;
-    private volatile boolean _maximumMessageSizeStatisticsEnabled;
 
     private final AccessControl _systemUserAllowed = new SubjectFixedResultAccessControl(new ResultCalculator()
     {
@@ -605,7 +604,6 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
         _fileSystemMaxUsagePercent = getContextValue(Integer.class, Broker.STORE_FILESYSTEM_MAX_USAGE_PERCENT);
         _flowToDiskCheckPeriod = getContextValue(Long.class, FLOW_TO_DISK_CHECK_PERIOD);
         _isDiscardGlobalSharedSubscriptionLinksOnDetach = getContextValue(Boolean.class, DISCARD_GLOBAL_SHARED_SUBSCRIPTION_LINKS_ON_DETACH);
-        _maximumMessageSizeStatisticsEnabled = getContextValue(Boolean.class, Broker.MAX_MESSAGE_SIZE__STATISTICS_ENABLED);
 
         QpidServiceLoader serviceLoader = new QpidServiceLoader();
         for(ConnectionValidator validator : serviceLoader.instancesOf(ConnectionValidator.class))
@@ -1507,13 +1505,9 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
     }
 
     @Override
-    public long getMaximumMessageSize()
+    public long getInboundMessageSizeHighWatermark()
     {
-        if (_maximumMessageSizeStatisticsEnabled)
-        {
-            return _maximumMessageSize.get();
-        }
-        return 0;
+        return _maximumMessageSize.get();
     }
 
     @Override
@@ -1701,9 +1695,10 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
         _messagesIn.incrementAndGet();
         _bytesIn.addAndGet(messageSize);
         _broker.registerMessageReceived(messageSize);
-        if (_maximumMessageSizeStatisticsEnabled)
+        long hwm;
+        while((hwm = _maximumMessageSize.get()) < messageSize)
         {
-            _maximumMessageSize.getAndUpdate(current ->  messageSize > current ? messageSize : current);
+            _maximumMessageSize.compareAndSet(hwm, messageSize);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0b63b074/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java
index 5484923..9f1b318 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueManagingVirtualHost.java
@@ -283,11 +283,9 @@ public interface QueueManagingVirtualHost<X extends QueueManagingVirtualHost<X>>
     @SuppressWarnings("unused")
     @ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME,
             units = StatisticUnit.BYTES,
-            label = "Maximum inbound message size",
-            description = "Maximum size of message published into the Virtual Host since start-up."
-                          + " The statistics is only evaluated when context variable"
-                          + " 'qpid.broker.maxMessageSizeStatisticsEnabled' is set to 'true'.")
-    long getMaximumMessageSize();
+            label = "Maximum recorded size of inbound messages",
+            description = "Maximum size of message published into the Virtual Host since start-up.")
+    long getInboundMessageSizeHighWatermark();
 
     @Override
     @ManagedOperation(nonModifying = true, changesConfiguredObjectState = false)


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