Skip to content

Add zenPings(ImmutableList) again #9099

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ public ImmutableList<? extends ZenPing> zenPings() {
return this.zenPings;
}

/**
* This method could be used by discovery plugins. For example in EC2 discovery,
* we are adding a HostsProvider to unicastZenPing.
* This hosts provider makes AWS API calls to get back the list of potential elasticsearch nodes.
* https://github.com/elasticsearch/elasticsearch-cloud-aws/blob/master/src/main/java/org/elasticsearch/discovery/ec2/Ec2Discovery.java#L64-71
*/
@SuppressWarnings("unused")
public void zenPings(ImmutableList<? extends ZenPing> pings) {
this.zenPings = pings;
if (lifecycle.started()) {
for (ZenPing zenPing : zenPings) {
zenPing.start();
}
} else if (lifecycle.stopped()) {
for (ZenPing zenPing : zenPings) {
zenPing.stop();
}
}
}

@Override
public void setPingContextProvider(PingContextProvider contextProvider) {
if (lifecycle.started()) {
Expand Down