title: Is there any way to 'return early' from a Java AWS Lambda RequestStreamHandler
body: <p>I'm using API gateway to call an Java AWS Lambda via https.</p>
  
  <p>I have a case where I quickly know what status I want to return from my Lambda, but I have more work to do which will not affect the status.</p>
  
  <p>Is there any way of providing a status to the caller, but not ending execution of the Lambda?</p>
  
  <p>I've tried:</p>
  
  <pre><code>@Override
  public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
      JsonWriter writer = new JsonWriter(new OutputStreamWriter(outputStream));
      writer.beginObject();
      writer.name("statusCode").value("200");
      writer.endObject();
      writer.flush();
      writer.close();
      try {
          // this wait represents other work my Lambda is doing,
          // e.g. DB calls, requests to other webservices
          Thread.sleep(10 * 1000);
      } catch (InterruptedException e) {
      }
  }
  </code></pre>
  
  <p>But it still takes 10 seconds for the caller to see a status.
  Is there any way to do what I want?</p>
  
  <p>I would like to keep my application as simple as possible, and start as few Lambdas as possible, without making the caller wait any more than is necessary.</p>