ExecutorService SingleThreadExecutor
<p>I have a list of objects, from which depending on user interaction some objects need to do work asynchronically. Something like this:</p>

<pre><code>for(TheObject o : this.listOfObjects) {
   o.doWork();
}
</code></pre>

<p>The class <code>TheObject</code> implements an <code>ExecutorService</code> (SingleThread!), which is used to do the work. Every object of type TheObject instantiates an <code>ExecutorService</code>. I don't want to make <a href="https://en.wikipedia.org/wiki/Spaghetti_code#Lasagna_code" rel="nofollow">lasagna code</a>. I don't have enough Objects at the same time, to make an extra extraction layer with thread pooling needed.</p>

<p>I want to cite the Java Documentation about <a href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html#newCachedThreadPool%28%29" rel="nofollow">CachedThreadPools</a>:</p>

<blockquote>
  <p>Threads that have not been used for sixty seconds <strong>are terminated and
  removed from the cache.</strong> Thus, a pool that remains idle for long enough
  <strong>will not consume any resources.</strong></p>
</blockquote>

<p><em>First question:</em> Is this also true for a SingleThreadExecutor? Does the thread get terminated? JavaDoc doesn't say anything about SingleThreadExecutor. It wouldn't even matter in this application, as I have an amount of objects I can count on one hand. Just curiosity.</p>

<p>Furthermore the <code>doWork()</code> method of <code>TheObject</code> needs to call the <code>ExecutorService#.submit()</code> method to do the work async. Is it possible (I bet it is) to call the <code>doWork()</code> method implicitly? Is this a viable way of designing an async method?</p>

<pre><code>void doWork() {
   if(!isRunningAsync) {
      myExecutor.submit(doWork());
   } else {
      // Do Work...
   }
}
</code></pre>