Page 1 of 1
About Question enthuware.ocpjp.v8.2.1761 :
Posted: Thu Nov 26, 2015 12:11 am
by ashish
Question asked on CyclicBarrier.
But this is not in Java8 upgrade course .
How this question came in simulator provided by you ?
Re: About Question enthuware.ocpjp.v8.2.1761 :
Posted: Thu Nov 26, 2015 3:54 am
by admin
It is there because some test takers reported getting a question on it.
Re: About Question enthuware.ocpjp.v8.2.1761 :
Posted: Tue Dec 22, 2015 8:35 am
by mrmuiz
CyclicBarrier is actually listed in the
official exam topic list
Re: About Question enthuware.ocpjp.v8.2.1761 :
Posted: Fri Mar 04, 2016 2:27 pm
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.
Re: About Question enthuware.ocpjp.v8.2.1761 :
Posted: Fri Mar 04, 2016 8:34 pm
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.