title: ThreadPoolTaskScheduler behaviour when pool is full
body: <p>I need to implement a service that read periodically a directory and process the file found in it. 
  I want to read the directory pretty often, each 5 seconds for example. The problem is that sending the files could take several time. When the files are sent a moved them away. 
  My idea is to use <code>ThreadPoolTaskScheduler</code> with a single thread pool and shedule the task to run each 5 seconds. 
  The solution seems to work, I read often the directory and when is empty the task finished quickly. When I found some files the task takes longer but since there pool is one thread only no other concurrent tasks are executed.</p>
  
  <p>My problem is that I can't understand what happened to the tasks scheduled that cannot run because the pool is full? are they canceled or just enqueued. I'm worried to enqueue too much tasks and create memory leaks.</p>
  
  <p>This is my spring.xml</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context"
       xmlns:task="http://www.springframework.org/schema/task"
          xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.2.xsd
          http://www.springframework.org/schema/task
          http://www.springframework.org/schema/task/spring-task-3.2.xsd"&gt;
  ....
      &lt;bean id="inviaFattureTask"  class="com.sirio.fatturazionepa.invio.InviaFattureTask"&gt;
          &lt;property name="fileSystemUtils" ref="fileSystemUtils"&gt;&lt;/property&gt;
          &lt;property name="fattureManager" ref="fattureManager"&gt;&lt;/property&gt;
      &lt;/bean&gt;
      &lt;task:scheduler id="myScheduler" pool-size="1"/&gt;
  
  ...
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>and java code.</p>
  
  <pre><code>TaskScheduler ts = appContext.getBean(TaskScheduler.class);
          InviaFattureTask task = appContext.getBean(InviaFattureTask.class);
           ts.schedule(task, new CronTrigger("*/5 * * * * ?"));
  </code></pre>
  
  <p>Thanks Davide</p>