java ee 6 - What's difference between `javax.servlet.AsyncContext.startAsync()` and `new Thread(Runnable).start()`? -
i have read article 17.12 asynchronous processing
what difference between:
public void doget(httpservletrequest req, httpservletresponse resp) { asynccontext acontext = req.startasync(); ... }
and
public void doget(httpservletrequest req, httpservletresponse resp) { runnable runnable = ... new thread(runnable).start(); ... }
the difference lies in 'who' controlling thread. when asynccontext request, use start method , pass instance of runnable, container manages thread in executes logic passed in runnable instance. not case when fire thread using new thread(runnable).start()
Comments
Post a Comment