title: Clarification on inner workings of IntentService
body: <p>I'm trying to understand a particular bit of logic in <code>IntentService</code>, specifically, in <code>ServiceHandler</code>:</p>
  
  <pre><code>private final class ServiceHandler extends Handler {
      public ServiceHandler(Looper looper) {
          super(looper);
      }
  
      @Override
      public void handleMessage(Message msg) {
          onHandleIntent((Intent)msg.obj);
          stopSelf(msg.arg1);
      }
  }
  </code></pre>
  
  <p>From what I can tell, <code>stopSelf()</code> is being called multiple times - once for every <code>startService</code> call. If there are multiple items to handle, will <code>stopSelf</code> not interrupt the flow of the pending items? Clearly that's not what's happening, since <code>IntentService</code> actually works, but why? Seems like <code>stopSelf</code> should be called after all the <code>Intent</code>s are handled.</p>
  
  <p>Another question - when will the <code>HandlerThread</code> created in <code>onCreate</code> actually stop? Clearly it's not halted by <code>stopSelf</code>?</p>