# Client Pooling with HeadlessClient Plugin

**URL:** <https://forum.servoy.com/t/client-pooling-with-headlessclient-plugin/12460>\
**Category:** Classic Servoy\
**Created:** [July 12, 2010, 1:53am UTC](https://forum.servoy.com/t/client-pooling-with-headlessclient-plugin/12460 "2010-07-12T01:53:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbutler](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/sbutler/32/4393_2.png) [@sbutler](https://forum.servoy.com/u/sbutler)\
**Post date:** [July 12, 2010, 1:53am UTC](https://forum.servoy.com/t/client-pooling-with-headlessclient-plugin/12460/1 "2010-07-12T01:53:14Z")

</div>

In the rest\_ws plugin for restful web services, client pooling is built into the plugin. It would be nice to have this same option in the HeadlessClient plugin. I have written some code in a module to simulate pooling (simple round-robin approach) with headless clients, but real pooling can only be done in the java side of the plugin.

This is useful for some customers I have that deal a lot with third-party API’s where lots of requests are sent off server-side via some API, and then when the responses are received they update the database to record the response. However, some requests can take a while to process, but you don’t want to have to spawn a new headless client instance for each individual request.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 12, 2010, 10:25am UTC](https://forum.servoy.com/t/client-pooling-with-headlessclient-plugin/12460/2 "2010-07-12T10:25:29Z")

</div>

So we currently have the option to create a new client or to reuse an existing client.

and a JSClient instance on the server is a 1-1 with something on the server (so that you could also share and know the state on the server between calls)

But if you want you can try to create a pooling option inside the plugin by creating another createClient method where you have an extra boolean that tells the server to use a pool (of clients with a specific solution loaded)  
And then the queueMethod also gives this boolean so that the server knows that it can use a randomly client that is not used yet.

Problem is that in this mode getDataProviderValue especially with an empty “currently executing function” argument doesnt make any sense…

But create a patch and we will see how it works out ![:)]( "Smile")
