-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misc updates: performance, logging, hacking #142
Misc updates: performance, logging, hacking #142
Conversation
…ation a new instance
…lope UUID which is used internally (for logging only)
…dom message': there is no need for secure random here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Random random = ThreadLocalRandom.current(); | ||
this.id = new UUID(random.nextLong(), random.nextLong()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we only use this for logging, I wonder if we'd be better off just using AtomicLong.getAndIncrement
to assign a simple unique identifier. Could seed it with a large number if we wanted to keep it reasonably long and easier to search for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, makes sense 👍 ffb9501
Minor modifications to your idea:
- initialize the id generator with only upper 32 bits randomly generated to easily track envelope ordering with eyes.
- return id as a hex String
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. :)
PR Description
A batch of minor updates:
Performance:
SecureRandom
for newNodeSession
instead of expensive creation a new instanceRandom
instead ofSecureRandom
to generate Envelope UUID which is used internally (for logging only)Random
instead ofSecureRandom
to generate 'random message': there is no need for secure random here (even a static zeroes payload should not compromise the security)Logging:
DEBUG
levelHacking: