title: How to use a single Task Pool across all request for an application using Spring TaskExecutor
body: <p>How do i use the spring TaskExecutor to spawn tasks such that the outof memory exception are not thrown.</p>
  
  <p>Current task pool configuration:</p>
  
  <pre><code>&lt;bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"&gt;
    &lt;property name="corePoolSize" value="56" /&gt;
    &lt;property name="maxPoolSize" value="112" /&gt;
    &lt;property name="queueCapacity" value="100" /&gt;
  &lt;/bean&gt;
  &lt;bean id="threadExecutor" class="com.content.ThreadHandler.ThreadExecutor"&gt;
    &lt;constructor-arg ref="taskExecutor" /&gt;
  &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>and i am using the bean in my request handler by using the load bean as:</p>
  
  <pre><code>ApplicationContext context=new ClassPathXmlApplicationContext(new String[]{"ThreadPoolConfig.xml"});
              BeanFactory factory=context;
  
              ThreadExecutor myBean=(ThreadExecutor)factory.getBean("threadExecutor");
  </code></pre>
  
  <p>and then i use the taskexecutor as mybean.execute(task);</p>
  
  <p>Does this configuration create a new pool for each request?</p>