views:

31

answers:

2

What are the disadvantages of creating my own threads inside a managed environment like a weblogic application server?
I have always used managed threads (using the WorkManager api) whenever i am working inside an application server.
However I am unclear on the disadvantages or issues that might be caused by using non-managed threads inside the app server.

+1  A: 

You just lose the benefits of having managed threads. Managed threads give you the ability to allocate threads from "pools" with maximal and minimal size, an increment rate, and the ability to queue requests for each pool if it is under heavy load. you also have the benefit of being able to monitor these threads and control their behavior in run-time (e.g. from the Weblogic console).

ozk
A: 

When you run small amount of code in the thraed, and it's not waiting for other thread (not a vast use in locks etc.) there is no problem using the thread pool.

but when your thread needs to run a large amount of code, for long period (for example, waiting on locks, waiting for specific resources), it's not a good practice to use the thread pool etc.

Another problem is that when you use the pool for threads that run the main logic of the program, you might get stuck, waiting for other threads to finish. that's another practice where you should manage you're own threads.

Adibe7