About Question enthuware.ocpjp.v8.2.1761 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ashish
Posts: 9
Joined: Wed Nov 25, 2015 11:54 pm
Contact:

About Question enthuware.ocpjp.v8.2.1761 :

Post by ashish »

Question asked on CyclicBarrier.
But this is not in Java8 upgrade course .

How this question came in simulator provided by you ?

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

Re: About Question enthuware.ocpjp.v8.2.1761 :

Post by admin »

It is there because some test takers reported getting a question on it.

mrmuiz
Posts: 49
Joined: Mon Jul 27, 2015 4:34 am
Contact:

Re: About Question enthuware.ocpjp.v8.2.1761 :

Post by mrmuiz »

CyclicBarrier is actually listed in the official exam topic list

javalass
Posts: 54
Joined: Thu Mar 03, 2016 1:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1761 :

Post by javalass »

The question says:
What should be inserted in the following code such that run methods of ItemProcessor as well Merger will be executed?
Both the first and the second answers ensure that the run() methods of ItemProcessor and Merger are executed.

The option below is also correct:
Make ItemProcessor extend Thread instead of implementing Runnable and add CyclicBarrier cb = new CyclicBarrier(1, m); to //LINE 3
This is pretty useless as a CyclicBarrier, I know, as it lets every thread pass through it without any of them waiting, but it executes the merger's run() method every time cb.await() is called. Since no threads are held, when ip.start() is called, the ItemProcessor's run() method also executes normally.

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

Re: About Question enthuware.ocpjp.v8.2.1761 :

Post by admin »

Yes, you are right. Option 1 will let merger's run execute, but twice. The problem statement has now been updated to make the intention of the question clear.

thank you for your feedback!
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests