You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by wolverine my <wo...@gmail.com> on 2007/05/03 11:27:27 UTC

[AsyncWeb] HttpService

Hi!

Looking at the example, is the AsyncWeb creates new
HelloWorldHttpService instance for every HttpRequest? Meaning, if
there are 100 requests coming in, there will be 100 of
HelloWorldHttpService instances created internally?

What will happen if I need to wait for a long time before I can commit
the response to the request like the following?

public class MyHttpService implements HttpService {
  public void handleRequest(HttpRequest request) {
    HttpResponse response = request.createHttpResponse();

    // WAIT FOR LONG RUNNING PROCESS HERE ...

    request.commitResponse(response);
  }
}


What is the recommended way to handle a long running process before
returning the response? e.g. start a seperate thread?

Please advise, thank you!