# Thread Pool Information Using Java API

**URL:** <https://discuss.elastic.co/t/thread-pool-information-using-java-api/616>\
**Category:** Elasticsearch\
**Created:** [May 13, 2015, 12:40pm UTC](https://discuss.elastic.co/t/thread-pool-information-using-java-api/616 "2015-05-13T12:40:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed\_Brown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ed_brown/32/19230_2.png) [@Ed\_Brown](https://discuss.elastic.co/u/Ed_Brown)\
**Post date:** [May 13, 2015, 12:40pm UTC](https://discuss.elastic.co/t/thread-pool-information-using-java-api/616/1 "2015-05-13T12:40:31Z")

</div>

Good morning,  
I'm trying to get the same information using the Java API that I can get using the curl command, "curl localhost:9200/\_cat/threadpool".

I'm using the TransportClient API to get the client connection to ElasticSearch.

When I use client.admin().cluster().threadpool(), and iterate over stats(), the only thread pool name that is populated with information is "generic", even though the curl command shows otherwise.

What is the correct API I should be using?

## Thank you.

Ed Brown  
Software Architect

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 13, 2015, 2:49pm UTC](https://discuss.elastic.co/t/thread-pool-information-using-java-api/616/2 "2015-05-13T14:49:17Z")

</div>

You need to use `client().admin().cluster().prepareNodesStats().get()` which will give you an iterator over some NodeStats objects, and these objects have a `getThreadPool` property that you can use to get information about thread pools.

---

<div class="post-metadata">

**Author:** ![Ed\_Brown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ed_brown/32/19230_2.png) [@Ed\_Brown](https://discuss.elastic.co/u/Ed_Brown)\
**Post date:** [May 13, 2015, 6:12pm UTC](https://discuss.elastic.co/t/thread-pool-information-using-java-api/616/3 "2015-05-13T18:12:40Z")

</div>

Adrien  
Thank you. You sent me in the right direction, but it missing one method call. The solution is:  
**client().admin().prepareNodesStats()._all()_.get()**;

Thank you! 😃  
Ed Brown  
Software Architect

---

<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, 12:14am UTC](https://discuss.elastic.co/t/thread-pool-information-using-java-api/616/4 "2017-07-06T00:14:13Z")

</div>


