Page 1 of 1

About Question enthuware.ocpjp.v7.2.1561 :

Posted: Sat Sep 19, 2015 9:23 am
by thisOtterBeGood
Hi there,
isn't java.util.concurrent.Executor.execute(Runnable) another option here? I can pass in a Thread instance, too.

The question does not explicitly ask for a method within the Thread class.

Regards,
Bernhard

Re: About Question enthuware.ocpjp.v7.2.1561 :

Posted: Sat Sep 19, 2015 10:29 am
by admin
Executor.execute doesn't really schedule a thread for execution. It already has threads and those thread are already executing. Executor.execute actually schedules a "task" for execution and it uses its own managed threads to execute that task. It is a different matter that the "task" is captured using a Runnable or Callable (as the case may be).

HTH,
Paul

Re: About Question enthuware.ocpjp.v7.2.1561 :

Posted: Sun Sep 20, 2015 12:39 am
by thisOtterBeGood
Thanks for clearing that up!

Re: About Question enthuware.ocpjp.v7.2.1561 :

Posted: Sat Aug 06, 2016 3:58 pm
by insider
The word "schedule" has confused me a lot. I actually thought it's about ScheduledExecutorService's scheduleXXX() methods.