[
https://issues.apache.org/jira/browse/ARTEMIS-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17853494#comment-17853494
]
Galkin Alexey commented on ARTEMIS-4810:
----------------------------------------
Using {{java.net.URL}} may result in lower performance than {{java.net.URI}}
for the following reasons:
1)Network Operations: The equals and hashCode methods in the URL class can
cause network operations such as DNS resolution, resulting in significant
latency.
2)Mutability: URL objects can change, which requires additional checks and can
increase the execution time of comparison and hashing operations.
3)Unpredictability: Network operations can have unpredictable execution times,
which is especially critical for use in associative arrays where fast and
predictable operation of the equals and hashCode methods is important.
For these reasons, {{java.net.URI}} is the preferred choice for storing
references in associative arrays, providing better performance and
predictability.
> Maps of URLs can reduce the performance in ReloadManagerImpl.java
> -----------------------------------------------------------------
>
> Key: ARTEMIS-4810
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4810
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Galkin Alexey
> Priority: Minor
>
> [In line
> 41|https://github.com/apache/activemq-artemis/blob/main/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/reload/ReloadManagerImpl.java#L41],
> when creating an associative array registry, you can use java.net.URI
> instead of java.net.URL to avoid the performance penalty
> {code:java}
> private final Map<URL, ReloadRegistry> registry = new HashMap<>();{code}
--
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