Skip to content

Conversation

@maltalex
Copy link
Contributor

@maltalex maltalex commented Sep 2, 2021

Header::getID synchronized on a static field causing unnecessary locking
especially when the ID field didn't need to be generated. As per the
discussion in #215, this was due to a desire to have the ID generation
be lazy, which is no longer needed.

This commit changes the ID generation behavior so the ID is either
explicitly supplied to the constructor, or generated by the constructor
using the same SecureRandom instance. This makes the getID method a
simple getter with no need for synchronization

Header::getID synchronized on a static field causing unnecessary locking
especially when the ID field didn't need to be generated. As per the
discussion in dnsjava#215, this was due to a desire to have the ID generation
be lazy, which is no longer needed.

This commit changes the ID generation behavior so the ID is either
explicitly supplied to the constructor, or generated by the constructor
using the same SecureRandom instance. This makes the getID method a
simple getter with no need for synchronization
@ibauersachs ibauersachs merged commit b30b05c into dnsjava:release/3.4.x Sep 2, 2021
@ibauersachs
Copy link
Member

Thanks!

@ibauersachs ibauersachs linked an issue Sep 12, 2021 that may be closed by this pull request
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.

Unnecessary synchronization in org.xbill.DNS.Header::getID

2 participants