Skip to content
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

Refactor UUID-generating methods out of Strings #17837

Merged
merged 1 commit into from Apr 19, 2016
Merged

Refactor UUID-generating methods out of Strings #17837

merged 1 commit into from Apr 19, 2016

Conversation

jasontedor
Copy link
Member

@jasontedor jasontedor commented Apr 18, 2016

This commit refactors the UUID-generating methods out of Strings into
their own class. The primary motive for this refactoring is to avoid a
chain of class initializers from loading this class earlier than
necessary. This was discovered when it was noticed that starting
Elasticsearch without any active network interfaces leads to some
logging statements being executed before logging had been
initailized. Thus:

  • these UUID methods have no place being on Strings
  • removing them reduces spooky action-at-distance loading of this class
  • removed the troublesome, logging statements from MacAddressProvider,
    logging using statically-initialized instances of ESLogger are prone
    to this problem

Closes #17819

// address will be set below
}

if (!isValidAddress(address)) {
logger.warn("Unable to get a valid mac address, will use a dummy address");
Copy link
Member

Choose a reason for hiding this comment

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

Is it ok to have no feedback in this case? I guess given the initialization chain we had we weren't getting any anyway but maybe it'd be nice?

@nik9000
Copy link
Member

nik9000 commented Apr 19, 2016

LGTM. Left a comment about not getting a log message we weren't getting anyway. It'd be nice if we knew if we were falling back to a bogus mac address, I guess, but maybe we can fix that problem in another PR outside of the "move stuff" PR.

This commit refactors the UUID-generating methods out of Strings into
their own class. The primary motive for this refactoring is to avoid a
chain of class initializers from loading this class earlier than
necessary. This was discovered when it was noticed that starting
Elasticsearch without any active network interfaces leads to some
logging statements being executed before logging had been
initailized. Thus:
 - these UUID methods have no place being on Strings
 - removing them reduces spooky action-at-distance loading of this class
 - removed the troublesome, logging statements from MacAddressProvider,
   logging using statically-initialized instances of ESLogger are prone
   to this problem
@jasontedor jasontedor merged commit ace83d9 into elastic:master Apr 19, 2016
@jasontedor jasontedor deleted the uuid-initialization branch April 19, 2016 01:43
@jasontedor
Copy link
Member Author

jasontedor commented Apr 19, 2016

Thanks @nik9000. I'm not heartbroken over the loss of the logging statement that was never there to begin with, especially since I do not immediately see a clean way to achieve logging there without using an offensive statically-initialized static logger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Core Core issues without another label v5.0.0-alpha2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants