title: Spawn threads in a Spring RestController
body: <p>I have a bit of a strange question about threading... need some advice.</p>
  
  <p>I am running my Spring4 webapp on Tomcat8. I have configured restful endpoint using Spring MVC to pick up requests going to "/rs/event/book/create"</p>
  
  <pre><code>@RequestMapping( 
          value = { "/rs/event/book/create" }, 
          method = RequestMethod.POST, 
          consumes=MediaType.APPLICATION_JSON_VALUE,
          produces=MediaType.APPLICATION_JSON_VALUE
  )
  public String bookCreate( @RequestBody Map&lt;String,Object&gt; jsonData ) { ... }
  </code></pre>
  
  <p>I will be making an Ajax call to this URL from the UI from time to time when the time is right.</p>
  
  <p>I want the request going to "/rs/event/book/create" to fire three threads each making an HTTP call to Zapier and falling through, without waiting for a response from Zapier or the client waiting for a response from "/rs/event/book/create" ( this is a temporary thing, almost like a POC until we have time to figure out a more elegant solution ).</p>
  
  <p>The issue is that I am afraid to just spawn threads ad-hoc and than not finishing or becoming zombies.</p>
  
  <p>What is the best / safest way to spawn three disposable threads so just that the request going to "/rs/event/book/create" will fire the three threads and fall through? ( I am not talking about Spring @Async )</p>
  
  <p>Thank you for you help friends!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I guess what I am really asking for here is if this is enough for me to not get in trouble long term?</p>
  
  <pre><code>@RequestMapping( 
          value = { "/rs/event/book/create" }, 
          method = RequestMethod.POST, 
          consumes=MediaType.APPLICATION_JSON_VALUE,
          produces=MediaType.APPLICATION_JSON_VALUE
  )
  public String bookCreate( @RequestBody Map&lt;String,Object&gt; jsonData ) {
      new Thread() {
          public void run() {
              // HTTP call to Zapier
          }
      }.start();
  
      new Thread() {
          public void run() {
              // HTTP call to Zapier
          }
      }.start();
  
      new Thread() {
          public void run() {
              // HTTP call to Zapier
          }
      }.start();
  
      return "";
  }
  </code></pre>