Replace deprecated StatsImpl.addStatistic with addStatistics(Set.of(..))#2061
Closed
trex-amazon wants to merge 1 commit into
Closed
Replace deprecated StatsImpl.addStatistic with addStatistics(Set.of(..))#2061trex-amazon wants to merge 1 commit into
trex-amazon wants to merge 1 commit into
Conversation
StatsImpl.addStatistic(String, StatisticImpl) is marked @deprecated(forRemoval = true, since = "6.2.0") and its String name argument is unused. Replace the remaining call sites in the broker statistics classes with the batched addStatistics(Collection) API, following the pattern already adopted in the activemq-client management classes (e.g. JMSSessionStatsImpl). Pure mechanical refactor: each constructor now registers its statistics in a single addStatistics(Set.of(...)) call. No behavioral change -- the statistics are stored in the same backing set; only the redundant, ignored name argument and the deprecated call are removed. Fixes apache#1984
Contributor
|
Closing, as this is a duplicate of #1985 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StatsImpl.addStatistic(String, StatisticImpl)is marked@Deprecated(forRemoval = true, since = "6.2.0"), and itsString nameargument 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 batchedaddStatistics(Collection)API.This follows the pattern already adopted in the
activemq-clientmanagement classes (e.g.JMSSessionStatsImpl,JCAConnectionPoolStatsImpl), and finishes migrating the broker-sideStatsImplsubclasses off the deprecated method.Fixes #1984
Changes
Each constructor now registers its statistics in a single
addStatistics(Set.of(...))call instead of multipleaddStatistic("name", stat)calls. Eight classes inactivemq-broker:broker/region/ConnectionStatisticsbroker/region/ConnectorStatisticsbroker/region/RegionStatisticsbroker/region/SubscriptionStatisticsnetwork/NetworkBridgeStatisticsstore/AbstractMessageStoreStatisticsstore/MessageStoreStatisticsstore/PersistenceAdapterStatisticsBehavioral impact
None. The statistics are stored in the same backing set; only the redundant (ignored)
nameargument and the deprecated call are removed. No public API changes, no new files.Testing
mvn clean compileonactivemq-broker(JDK 17) — builds clean; the previously-emitted deprecation warnings for these classes are gone.NetworkAdvancedStatisticsTest,BrokerStatisticsPluginTest,AbstractInflightMessageSizeTest, and the fullorg.apache.activemq.management.*/org.apache.activemq.statistics.*packages.