[
https://issues.apache.org/jira/browse/AMQ-8463?focusedWorklogId=953458&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-953458
]
ASF GitHub Bot logged work on AMQ-8463:
---------------------------------------
Author: ASF GitHub Bot
Created on: 21/Jan/25 21:55
Start Date: 21/Jan/25 21:55
Worklog Time Spent: 10m
Work Description: cshannon commented on code in PR #1329:
URL: https://github.com/apache/activemq/pull/1329#discussion_r1924396957
##########
activemq-broker/src/main/java/org/apache/activemq/broker/region/DestinationStatistics.java:
##########
@@ -233,6 +222,7 @@ public void setParent(DestinationStatistics parent) {
maxUncommittedExceededCount.setParent(parent.maxUncommittedExceededCount);
networkEnqueues.setParent(parent.networkEnqueues);
networkDequeues.setParent(parent.networkDequeues);
+ // [AMQ-9437] Advanced Message Statistics do not parent.
Review Comment:
```suggestion
// [AMQ-9437] Advanced Message Statistics does not have a parent.
```
##########
activemq-broker/src/main/java/org/apache/activemq/broker/region/DestinationStatistics.java:
##########
@@ -252,7 +242,29 @@ public void setParent(DestinationStatistics parent) {
maxUncommittedExceededCount.setParent(null);
networkEnqueues.setParent(null);
networkDequeues.setParent(null);
+ // [AMQ-9437] Advanced Message Statistics do not parent.
Review Comment:
```suggestion
// [AMQ-9437] Advanced Message Statistics does not have a parent.
```
##########
activemq-client/src/main/java/org/apache/activemq/management/StatisticImpl.java:
##########
@@ -15,22 +15,19 @@
* limitations under the License.
*/
package org.apache.activemq.management;
-
/**
- * Base class for a Statistic implementation
- *
- *
+ * A thread-safe class for a Statistic implementation
*/
public class StatisticImpl implements Statistic, Resettable {
- protected boolean enabled;
+ protected volatile boolean enabled;
- private String name;
- private String unit;
- private String description;
- private long startTime;
- private long lastSampleTime;
- private boolean doReset = true;
+ protected final String name;
Review Comment:
I don't think any of these needs to be made protected, no child classes use
them and if they need to read the value they could use a getter.
##########
activemq-broker/src/main/java/org/apache/activemq/broker/region/DestinationStatistics.java:
##########
@@ -252,7 +242,29 @@ public void setParent(DestinationStatistics parent) {
maxUncommittedExceededCount.setParent(null);
networkEnqueues.setParent(null);
networkDequeues.setParent(null);
+ // [AMQ-9437] Advanced Message Statistics do not parent.
}
}
+ // This is the only method that can mutate the messageFlowStats state
+ // so we only need to synchronize this method to make sure we don't have 2
threads
+ // trying to set at the same time.
+ public synchronized void setAdvancedMessageStatisticsEnabled(boolean
enabled) {
+ // we can just use the get() here on the reference as no other spot can
Review Comment:
You can get rid of this comment here after this was refactored
Issue Time Tracking
-------------------
Worklog Id: (was: 953458)
Time Spent: 5h 20m (was: 5h 10m)
> Add advancedMessageStatistics to destinations
> ---------------------------------------------
>
> Key: AMQ-8463
> URL: https://issues.apache.org/jira/browse/AMQ-8463
> Project: ActiveMQ Classic
> Issue Type: Improvement
> Components: Broker
> Reporter: Matt Pavlovich
> Assignee: Jean-Baptiste Onofré
> Priority: Major
> Fix For: 6.2.0, 5.18.7
>
> Time Spent: 5h 20m
> Remaining Estimate: 0h
>
> Observability and tracking metrics on the destination can provide current
> message age and indication of message flow activity.
> // Most recent enqueued message info
> enqueuedMessageID
> enqueuedMessageTimestamp
> enqueuedMessageBrokerInTime
> // Most recent dequeued message info
> dequeuedMessageID
> dequeuedMessageTimestamp
> dequeuedMessageBrokerInTime
> // First enqueue since boot
> firstEnqueuedMessageID
> firstEnqueuedMessageTimestamp
> firstEnqueuedMessageBrokerInTime
> // First dequeue since boot
> firstDequeuedMessageID
> firstDequeuedMessageTimestamp
> firstDequeuedMessageBrokerInTime
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact