Java Reference
In-Depth Information
prove the response time of an application by dividing a big task into smaller units that
will be executed simultaneously by many threads.
Risks of concurrency
Although each thread has its proper stack of execution, it is very common to have
multiple threads that share the same resources or depend on each other. In such
cases, the absence of good synchronization makes threading behavior unpredict-
able and can degrade system performance. For example, the lack of coordination of
interrelated threads can result in deadlocks and indefinitely interrupt processing.
Concurrency and Java EE
As we have seen previously, the misuse of threads can have catastrophic conse-
quences on an application. In the case of a container, it could not only compromise
its integrity, but also poorly exploit the resources provided to other components. This
is one of the reasons why developers were not allowed to create threads in a con-
tainer.
To enable implementation of concurrency within Java EE components, the Java EE
7 platform has integrated Concurrency Utilities. Using this API, a Java EE server can
becomeawareoftheresourcesthat areusedbythreadsandprovidethemwithgood
execution context. Furthermore, it allows the server to manage the pool and lifecycle
of threads.
Java EE Concurrency API
Concurrency Utilities for Java EE 1.0 was developed with the followings goals in
mind:
• To provide a simple and flexible concurrency API to the Java EE platform
without compromising the container
• To facilitate migration from Java SE to Java EE by providing consistency
between the concurrency programming models
• To allow the implementation of common and advanced concurrency patterns
Concurrency Utilities was built over the Concurrency Utilities API developed under
JSR-166 for Java SE (which facilitates the migration from Java SE to Java EE). It
Search WWH ::




Custom Search