trex-amazon opened a new pull request, #2061:
URL: https://github.com/apache/activemq/pull/2061
<!--
DRAFT PR body for apache/activemq #1984. NOT PUSHED / NOT OPENED.
Create after review with:
cd /Users/trevdyck/code/activemq
git push -u origin refactor/1984-batch-addstatistics
gh pr create --repo apache/activemq --base main \
--head trex-amazon:refactor/1984-batch-addstatistics \
--title "Replace deprecated StatsImpl.addStatistic with
addStatistics(Set.of(..))" \
--body-file /Users/trevdyck/code/sqs-jms-drafts/activemq-pr-1984-body.md
-->
## Summary
`StatsImpl.addStatistic(String, StatisticImpl)` is marked
`@Deprecated(forRemoval = true, since = "6.2.0")`, and its `String name`
argument is unused (the method simply adds the statistic to the backing set).
This PR replaces the remaining call sites in the broker statistics classes with
the batched `addStatistics(Collection)` API.
This follows the pattern already adopted in the `activemq-client` management
classes (e.g. `JMSSessionStatsImpl`, `JCAConnectionPoolStatsImpl`), and
finishes migrating the broker-side `StatsImpl` subclasses off the deprecated
method.
Fixes #1984
## Changes
Each constructor now registers its statistics in a single
`addStatistics(Set.of(...))` call instead of multiple `addStatistic("name",
stat)` calls. Eight classes in `activemq-broker`:
- `broker/region/ConnectionStatistics`
- `broker/region/ConnectorStatistics`
- `broker/region/RegionStatistics`
- `broker/region/SubscriptionStatistics`
- `network/NetworkBridgeStatistics`
- `store/AbstractMessageStoreStatistics`
- `store/MessageStoreStatistics`
- `store/PersistenceAdapterStatistics`
## Behavioral impact
None. The statistics are stored in the same backing set; only the redundant
(ignored) `name` argument and the deprecated call are removed. No public API
changes, no new files.
## Testing
- `mvn clean compile` on `activemq-broker` (JDK 17) — builds clean; the
previously-emitted deprecation warnings for these classes are gone.
- Statistics/management tests pass: `NetworkAdvancedStatisticsTest`,
`BrokerStatisticsPluginTest`, `AbstractInflightMessageSizeTest`, and the full
`org.apache.activemq.management.*` / `org.apache.activemq.statistics.*`
packages.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact