May 2, 2011, 7:20 a.m.
posted by freelancer
In the Java Platform Enterprise Edition (JEE) world, multithreading is typically not recommended because the application server is the only program that is supposed to have control over the threads within the JVM to ensure a stable application server environment. However, at times you may need multithreading in your JEE application. Isolating this multithreading to a single class where we can control the threading is a better design than, for example, multiple classes implementing their own threading. Regardless of how multithreading is designed/used for an application, careful thought should be given to synchronization, blocking, and other related issues.
JSE 5.0 introduced the java.util.concurrent package, previously developed by Doug Lea (note for pre-J2SE 5.0: use Doug Lea's backward-compatible distribution, which can be found at http://gee.cs.oswego.edu/dl/). This is a clean way to use multi-threading in your enterprise applications.