I have a webservice which in turn calls 10 other webservices and it results in higher response times.So i am using ExecutorService to spawn threads by spring servlet.xml config like below
<bean id="executorService" class="org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean" scope="prototype">
<property name="corePoolSize" value="3" />
<property name="maxPoolSize" value="4" />
<property name="keepAliveSeconds" value="5" />
</bean>
I am monitoring the threads in JvisualVM and noticing that there are 3 executorservices threads at all times. I am trying to understand if that's going to spin 3 threads for every request that comes thru or will all requests try and use the same 3 corePoolSize thats configured.
If all request coming are going to use 3 threads should increase the corepool size (if so to what number)?
Also, when should i shut down the executor service?
I am new to spinning threads this way,can someone help me understand how it works?