Why is spawning threads in Java EE container discouraged?

前端 未结 9 1916
清歌不尽
清歌不尽 2020-11-22 04:50

One of the first things I\'ve learned about Java EE development is that I shouldn\'t spawn my own threads inside a Java EE container. But when I come to think about it, I do

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 05:27

    Concurrency Utilities for Java EE

    There is now a standard, and correct way to create threads with the core Java EE API:

    • JSR 236: Concurrency Utilities for Java™ EE

    By using Concurrency Utils, you ensure that your new thread is created, and managed by the container, guaranteeing that all EE services are available.

    Examples here

提交回复
热议问题