Skip to content

Conversation

mattrpav
Copy link
Contributor

No description provided.

@mattrpav mattrpav self-assigned this Aug 26, 2025
@mattrpav mattrpav changed the title WIP: [AMQ-9692] Support destination gc sweep of destinations with only wildcard consumers [AMQ-9692] Support destination gc sweep of destinations with only wildcard consumers Aug 26, 2025
@mattrpav mattrpav requested a review from cshannon August 26, 2025 22:34
@mattrpav mattrpav changed the title [AMQ-9692] Support destination gc sweep of destinations with only wildcard consumers WIP: [AMQ-9692] Support destination gc sweep of destinations with only wildcard consumers Aug 26, 2025
@mattrpav mattrpav force-pushed the AMQ-9692 branch 2 times, most recently from 7f1115d to 8a4acfd Compare August 27, 2025 14:27
@mattrpav mattrpav changed the title WIP: [AMQ-9692] Support destination gc sweep of destinations with only wildcard consumers [AMQ-9692] Support destination gc sweep of destinations with only wildcard consumers Aug 27, 2025
}
return isActive;

var destinationActive = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not very efficient because it may need to iterate through the consumers more than once. The way this is written, it may iterate through the consumers twice if both isGcWithNetworkConsumers() and isGcWithOnlyWildcardConsumers() is true.

What would make more sense is to only iterate through the consumers one time and use the predicate API to specify what you are looking for. You could build a predicate that look for either a network consumer, or not a wildcard consumer or some combination quite easily using https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/function/Predicate.html . This would also make it easy to expand the criteria in the future for other conditions.

If all the flags are off then we wouldn't need to iterate through the consumers at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants