Are Executor and ExecutorService representing the concept of “Thread Pool”?

  Kiến thức lập trình

I’m trying to learn about Executors in Java.
I watched some videos about Executor in which the tutor said:

in Java, the concept of Thread Pool is represented using
ExecutorService.

and also I read another article in web which it said that the Executor interface represent the concept of Thread Pool in Java.

actually I studied the documentation for both (Executor & ExecutorService). there was not anything in those documentations about Thread Pool.

So now I’m confused about this issue and I think both of them do not represent the concept of Thread Pool. by the way, I saw this code:

public class CurrentThreadExecutor implements Executor {
    public void execute(Runnable r) {
        r.run();
    }
}

And this code helped me to be almost sure that Executor cannot be a Thread Poolemphasized text by itself. same with ExecutorService. (I know that classes like ThreadPoolExecutor, ForkJoinPool and ScheduledThreadPoolExecutor are representing the concept of Thread Pool)

Now, can You please help me to understand which predicate and sentence is true?
Thank You.

LEAVE A COMMENT