title: Gracefully shut down embedded tomcat 7
body: <p>We have a server that using embedded tomcat to accept http request.</p>
  
  <p>When we shut down our server we want to:</p>
  
  <p>1) Block all incoming request</p>
  
  <p>2) Wait for already accepted request to finish successfully before stop the tomcat engine</p>
  
  <p>After some testing, #1 is doable by stop the connector.</p>
  
  <p>For #2 we tried to stop tomcat engine, but looks like it doesn't wait for the existing request to finish.</p>
  
  <p>Any ideas about how to do #2?</p>