简体   繁体   中英

Difference between @Asynchronous and EJB Concurrency Utilities in Java EE 7 -ManagedExecutorService

What is the difference between @Asynchronous and the new EJB Concurrency Utilities in Java EE 7 ManagedExecutorService. When should i use one over the other.

Asynchronous run in the default thread pool (can be changed), and is restricted to EJB.

A ManagedExecutorService can be configured (min and max number of threads, idle time, hung time, etc), and allows submitting Runnables and Callables.

By configuring a ManagedExecutorService you can have more control over the execution when it comes to the number of concurrent tasks running in parallel, keeping the number of utilized resources (Data Base connections mostly) under control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM