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

ES-based Spouts use a static Client instance #258

Merged
merged 1 commit into from Feb 20, 2016
Merged

Conversation

jnioche
Copy link
Contributor

@jnioche jnioche commented Feb 19, 2016

The ES clients are thread-safe, there is no reason why they should not be shared among the Spout instances within the same worker.

@mattburns what do you think?

@jnioche jnioche added this to the 0.9 milestone Feb 19, 2016
@mattburns
Copy link
Contributor

Sounds like a good idea to me.

For future reference, here's a good pattern when you need to synchronize access to the construction of a a shared object: https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom

Totally irrelevant in this case because it happens within the open method and so doesn't need to be optimised for millions of repeated invocations. I just thought it was interesting ;)

jnioche added a commit that referenced this pull request Feb 20, 2016
ES-based Spouts use a static Client instance
@jnioche jnioche merged commit df64981 into master Feb 20, 2016
@jnioche jnioche deleted the sharedESClient4Spouts branch February 20, 2016 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants