Alex Rivera | Logout

Should you always use an ExecutorService instead of starting your own thread?

Asked 2010-07-13T12:49:14.937
15

With JDK >= 1.5, should the preferred way to start a thread always be an Executor or Executor Service, or are there still reasons to prefer to use a Thread.start if you don't need what an ExecutorService provides?

For syncronized, I used to think that using the new Lock implemenations was preferred, until I was explained otherwise. So I'm wondering the same thing about Executors. Are they just a way of handling more complex cases, or should they be the standard choice?

Edit
Report

1 Answer

12

Java Concurrency in Practice at least clearly states in section 6.2.:

The primary abstraction for task execution in the Java class libraries is not Thread, but Executor. [...]

Using an Executor is usually the easiest path to implementing a producer-consumer design in your application.

answered 2010-07-13T12:52:29.857

Your Answer