# Java Boker instances and poolsize

**URL:** <https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103>\
**Category:** Forum\
**Tags:** Mainframe-Integration, EntireX\
**Created:** [January 29, 2011, 12:24am UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103 "2011-01-29T00:24:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin6](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin6](https://techcommunity.softwareag.com/u/martin6)\
**Post date:** [January 29, 2011, 12:24am UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/1 "2011-01-29T00:24:28Z")

</div>

Hi,  
i´m confused about how the brokerID parameter “poolsize” works.

Suppose I have a Java Web Application that makes calls to Natural programs throught EntireX Broker.

To do this, we have a pool of java broker objects. We instantiate the corresponding RPCService (came from an IDL) and set a broker object that we teke from the pool.

It´s usefull or make sense that we create broker instances whith the poolsize parameter in the brokerId ??

Wich is the effect if we instatiate those borker object whith differents values of poolsize parameters ?

Thanks for your comments  
MArtin

---

<div class="post-metadata">

**Author:** ![martin6](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin6](https://techcommunity.softwareag.com/u/martin6)\
**Post date:** [February 2, 2011, 7:32pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/2 "2011-02-02T19:32:21Z")

</div>

Hey !! nobody is using java with entireX ???  
Please I need to make an application and I must know this issues…  
thanks !!!

---

<div class="post-metadata">

**Author:** ![Rolf\_Bahlke](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/rolf_bahlke/32/109_2.png) [@Rolf\_Bahlke](https://techcommunity.softwareag.com/u/Rolf_Bahlke)\
**Post date:** [February 2, 2011, 10:14pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/3 "2011-02-02T22:14:00Z")

</div>

The recommendation is not use different poolsize parameters for the same Broker. This would have the result that you create multiple socket pools and this is somehow counter-productive.

Practice has shown that the default of 32 sockets works well in most cases for client applications. If the size of your pool of Broker objects is greater then 32 you might consider to increase the pool size.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![martin6](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin6](https://techcommunity.softwareag.com/u/martin6)\
**Post date:** [February 2, 2011, 10:54pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/4 "2011-02-02T22:54:28Z")

</div>

thanks Rolf !!!

by same Broker in your recomendation you mind Broker EntireX Server or the java Broker Object?

Supposse I want to have more then 32 socket… this setting is made in every Java Broker instance ? (in every call to natural programs)  
Or this settings is only for that Java Broker Object ? In this case every Java Broker instance have it´s own pool of sockets ?

I really apreciate your oppinion.  
Thanks

---

<div class="post-metadata">

**Author:** ![Rolf\_Bahlke](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/rolf_bahlke/32/109_2.png) [@Rolf\_Bahlke](https://techcommunity.softwareag.com/u/Rolf_Bahlke)\
**Post date:** [February 3, 2011, 2:40pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/5 "2011-02-03T14:40:04Z")

</div>

Martin,

the setting is actually per broker ID as specified in the constructor of the Broker class.

So:  
new Broker(“host:1234?poolsize=10”,…);  
new Broker(“host:1234?poolsize=20”,…);  
would create 2 independent socket pools.

In your scenario you should always use the same poolsize parameter in the constructor of the Broker class:  
new Broker(“host:1234?poolsize=64”,…);  
Then you get one socket pool with a maximum of 64 sockets.

BTW if you set the tracelevel to 1 (e.g. via Broker.setTrace()) then you will see socket pool related messages in the trace.

---

<div class="post-metadata">

**Author:** ![martin6](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin6](https://techcommunity.softwareag.com/u/martin6)\
**Post date:** [February 4, 2011, 5:39pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/6 "2011-02-04T17:39:00Z")

</div>

Rolf, very clear your explanation.

Just for complete my knowledge of the whole process…

If I use the same poolsize parameter in every Broker java instance, suppose 10… this means that I will only have 10 success calls to Natural programs (10 new instance of java Broker objects - one per call) at the same time ?

And in the other hand, how do you see to have differents socket´s pool by differents web applications ? Is this a good aproach or only affect the performance of the Broker Server ?

Thanks  
Martin

---

<div class="post-metadata">

**Author:** ![Rolf\_Bahlke](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/rolf_bahlke/32/109_2.png) [@Rolf\_Bahlke](https://techcommunity.softwareag.com/u/Rolf_Bahlke)\
**Post date:** [February 4, 2011, 6:40pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/7 "2011-02-04T18:40:14Z")

</div>

Whenever the EntireX Java runtime has to call Broker (via TCP/IP or SSL) it will first retrieve an unused socket from the pool, then it will send the data to the Broker using this socket and once the reply from the Broker arrives it will return the socket to the pool.

In case there are no sockets in the pool (and this is the initial state) a new socket instance will be created - as long as the number of created sockets do not exceed the pool size.

What happens if the maximum number of sockets are in use ? In this case, the runtime waits for a free socket to become available. If the wait time expires, the runtime will throw back an 0013 0333 error to the caller (“All sockets in socket pool for {0} are in use (size: {1} sockets)”).

The default wait time is 10 seconds, it can be changed via the system property “entirex.timeout”.

> [@](#):
>
> this means that I will only have 10 success calls to Natural programs (10 new instance of java Broker objects - one per call) at the same time ?

This might happen, but depending on how long one call lasts and how many calls in parallel you do all calls might be successful !

---

<div class="post-metadata">

**Author:** ![martin6](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin6](https://techcommunity.softwareag.com/u/martin6)\
**Post date:** [February 5, 2011, 12:26am UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/8 "2011-02-05T00:26:01Z")

</div>

Rolf, correct me if I am wrong, but the calls must be paralell for use the socket pool, because they if they are not paralell, the will be serialized o not ??  
So for every call we have to instantiate a java Borker object to make it parallell… or there is another way ?

thanks

---

<div class="post-metadata">

**Author:** ![martin6](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin6](https://techcommunity.softwareag.com/u/martin6)\
**Post date:** [February 7, 2011, 7:37pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/9 "2011-02-07T19:37:48Z")

</div>

Because multiple calls going throught the same java Broker Object are serializad… or not ?  
I read this in somewhere… and if this is true… how came to play the pool of sokets ??

thanks!!

---

<div class="post-metadata">

**Author:** ![Rolf\_Bahlke](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/rolf_bahlke/32/109_2.png) [@Rolf\_Bahlke](https://techcommunity.softwareag.com/u/Rolf_Bahlke)\
**Post date:** [February 9, 2011, 5:16pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/10 "2011-02-09T17:16:43Z")

</div>

All calls are using the socket pool.

Serialization occurs only if the same instance of a Broker object is used at the same time in multiple threads.

---

<div class="post-metadata">

**Author:** ![martin6](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@martin6](https://techcommunity.softwareag.com/u/martin6)\
**Post date:** [February 10, 2011, 11:11pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/11 "2011-02-10T23:11:34Z")

</div>

so, pool size came to play when multiple calls are doing with the same insatance of the java broker object ?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:59pm UTC](https://techcommunity.softwareag.com/t/java-boker-instances-and-poolsize/96103/12 "2021-04-02T14:59:43Z")

</div>


