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

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -