Behavior of Java's ScheduledExecutorService.scheduleAtFixedRate()
<p>I have a question regarding the <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledExecutorService.html#scheduleAtFixedRate%28java.lang.Runnable,%20long,%20long,%20java.util.concurrent.TimeUnit%29" rel="nofollow">scheduleAtFixedRate()</a> method on ScheduledExecutorService in Java 6. </p>

<p>[<strong><em>edit</em></strong>: the Javadoc for 1.6 is more complete than that for 1.5. See comment below]</p>

<p>Given that:</p>

<ul>
<li>the ScheduledExecutorService is constructed with N = 1 thread in the pool</li>
<li>the fixed-rate is a period of T seconds</li>
<li>no initial delay</li>
</ul>

<p>What happens in this case (times are not meant to be absolute, in the real-time sense):</p>

<ul>
<li>at time T, the service kicks off a Runnable task, "task1"</li>
<li>at time 2T, task1 has not yet completed, and service is scheduled to fire </li>
</ul>

<p>Is the service guaranteed to do any of the following?</p>

<ul>
<li>(a) at 2T, kick off a Runnable task, "task2" (recall N = 1)</li>
<li>(b) block until task1 is finished</li>
<li>(c) skip this time and try again at 3T</li>
<li>(d) behavior is undefined </li>
</ul>

<p>Or something else? Does the answer change if N > 1 ?</p>
