# Fetch Realm settings from elasticsearch.yml file in a static way on class load

**URL:** <https://discuss.elastic.co/t/fetch-realm-settings-from-elasticsearch-yml-file-in-a-static-way-on-class-load/146592>\
**Category:** Elasticsearch\
**Created:** [August 30, 2018, 12:54am UTC](https://discuss.elastic.co/t/fetch-realm-settings-from-elasticsearch-yml-file-in-a-static-way-on-class-load/146592 "2018-08-30T00:54:42Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [August 30, 2018, 2:11am UTC](https://discuss.elastic.co/t/fetch-realm-settings-from-elasticsearch-yml-file-in-a-static-way-on-class-load/146592/4 "2018-08-30T02:11:06Z")

</div>

> [@gautu7](#):
>
> I have just one CustomRealmType and since many instances are being created on the JVM by the factory class with multiple requests coming in

That is not how realms work.

> [@Caching Custom Realm Plugin tokens](https://discuss.elastic.co/t/caching-custom-realm-plugin-tokens/145972/6):
>
> Your Realm is a singleton. There is 1 instance of your realm per ES node, so a non-static cache is fine.

---

_[View the full topic](https://discuss.elastic.co/t/fetch-realm-settings-from-elasticsearch-yml-file-in-a-static-way-on-class-load/146592)._
