About Question enthuware.ocpjp.v21.2.4003 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Veilok
Posts: 21
Joined: Sat Sep 01, 2018 10:53 am
Contact:

About Question enthuware.ocpjp.v21.2.4003 :

Post by Veilok »

I'm a bit confused about what exactly the phrase "has just executed the line marked //LINE..." refers to.

Based on the correct answer, in the case of LINE 10, it seems to mean before the status changes from TIMED_WAITING to RUNNABLE.

However, in the case of LINE 21, it seems to mean after the status has already changed from RUNNABLE to BLOCKED.

This feels inconsistent to me. Could you please clarify?

admin
Site Admin
Posts: 10382
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v21.2.4003 :

Post by admin »

It is just trying to convey that the statements that have been just been executed by each thread. The calculation thread has executed Thread.sleep(5000);, which means this thread is now in TIMED_WAITING state. The sleep time is not over yet (because it has *just* executed the sleep instruction. It will sleep for 5 seconds now.)

The main thread has just executed synchronized(c), which means, it is now in BLOCKED state because the lock is not free.

Veilok
Posts: 21
Joined: Sat Sep 01, 2018 10:53 am
Contact:

Re: About Question enthuware.ocpjp.v21.2.4003 :

Post by Veilok »

Thank you, I somehow didn’t pay attention to the fact that "just executed" and the moment after the 5-second sleep are two different things.

Post Reply

Who is online

Users browsing this forum: No registered users and 99 guests