# Java API, is a client thread safe?

**URL:** <https://discuss.elastic.co/t/java-api-is-a-client-thread-safe/12288>\
**Category:** Elasticsearch\
**Created:** [June 5, 2013, 8:23pm UTC](https://discuss.elastic.co/t/java-api-is-a-client-thread-safe/12288 "2013-06-05T20:23:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Gaydenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_gaydenko/32/914_2.png) [@Andrew\_Gaydenko](https://discuss.elastic.co/u/Andrew_Gaydenko)\
**Post date:** [June 5, 2013, 8:23pm UTC](https://discuss.elastic.co/t/java-api-is-a-client-thread-safe/12288/1 "2013-06-05T20:23:41Z")

</div>

Is ES client got vianodeBuilder.client(true).clusterName(clusterName).node().client()thread  
safe (execution listeners are in use)? Can I have the only client for given  
cluster and given JVM? Is the client guarded against execution exceptions  
(that is the instance is kept intact on execution exceptions)? Is anybody  
using client caching (pooling)?

Or, all these questions can be folded into this one: is the client  
stateless? 🙂

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 5, 2013, 8:24pm UTC](https://discuss.elastic.co/t/java-api-is-a-client-thread-safe/12288/2 "2013-06-05T20:24:56Z")

</div>

Yeah. Only one client for the whole JVM.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 5 juin 2013 à 22:23, Andrew Gaydenko [andrew.gaydenko@gmail.com](mailto:andrew.gaydenko@gmail.com) a écrit :

> Is ES client got via nodeBuilder.client(true).clusterName(clusterName).node().client()thread safe (execution listeners are in use)? Can I have the only client for given cluster and given JVM? Is the client guarded against execution exceptions (that is the instance is kept intact on execution exceptions)? Is anybody using client caching (pooling)?
> 
> Or, all these questions can be folded into this one: is the client stateless? 🙂
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Andrew\_Gaydenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_gaydenko/32/914_2.png) [@Andrew\_Gaydenko](https://discuss.elastic.co/u/Andrew_Gaydenko)\
**Post date:** [June 5, 2013, 8:40pm UTC](https://discuss.elastic.co/t/java-api-is-a-client-thread-safe/12288/3 "2013-06-05T20:40:54Z")

</div>

On Thursday, June 6, 2013 12:24:56 AM UTC+4, David Pilato wrote:

> Yeah. Only one client for the whole JVM.

Great, thanks! It's the proper way 🙂

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:32am UTC](https://discuss.elastic.co/t/java-api-is-a-client-thread-safe/12288/4 "2017-07-06T02:32:41Z")

</div>


