-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Consider refactoring the usages of clusterService.addListener(this)
#37861
Labels
Comments
Pinging @elastic/es-core-infra |
26 tasks
closing as the meta issue for refactoring has been created #38560 |
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this issue
Oct 15, 2020
This change allows the setting for disabling the automatically installed stack templates (the `logs-*-*`, `metrics-*-*`, and `synthetics-*-*` templates) to be changed dynamically. As a byproduct, it also moves thes `IndexTemplateRegistry` to use an `initialize()` method so that constructors are not tempted to use a `this` reference in the constructor (see elastic#37861 for more information about why to avoid that). Resolves elastic#62835
dakrone
added a commit
that referenced
this issue
Oct 16, 2020
* Make stack.templates.enabled a dynamic setting This change allows the setting for disabling the automatically installed stack templates (the `logs-*-*`, `metrics-*-*`, and `synthetics-*-*` templates) to be changed dynamically. As a byproduct, it also moves thes `IndexTemplateRegistry` to use an `initialize()` method so that constructors are not tempted to use a `this` reference in the constructor (see #37861 for more information about why to avoid that). Resolves #62835
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this issue
Oct 16, 2020
* Make stack.templates.enabled a dynamic setting This change allows the setting for disabling the automatically installed stack templates (the `logs-*-*`, `metrics-*-*`, and `synthetics-*-*` templates) to be changed dynamically. As a byproduct, it also moves thes `IndexTemplateRegistry` to use an `initialize()` method so that constructors are not tempted to use a `this` reference in the constructor (see elastic#37861 for more information about why to avoid that). Resolves elastic#62835
dakrone
added a commit
that referenced
this issue
Oct 16, 2020
* Make stack.templates.enabled a dynamic setting This change allows the setting for disabling the automatically installed stack templates (the `logs-*-*`, `metrics-*-*`, and `synthetics-*-*` templates) to be changed dynamically. As a byproduct, it also moves thes `IndexTemplateRegistry` to use an `initialize()` method so that constructors are not tempted to use a `this` reference in the constructor (see #37861 for more information about why to avoid that). Resolves #62835
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I noticed few implementations of
ClusterStateListener
registering itself to aClusterService
within constructor using a possibly dangerous construct:This is explicitly publishing
this
reference before the object is constructed. That can in turn lead to race conditions and visibility problems .It is well described by Brian Goetz in his articles or in his book
sample article: https://www.ibm.com/developerworks/library/j-jtp0618/index.html
That is also mentioned in a java language specification JLS 17.5 final field semantics
The text was updated successfully, but these errors were encountered: