About Question enthuware.ocpjp.v8.2.1707 :

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

Moderator: admin

Post Reply
johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

About Question enthuware.ocpjp.v8.2.1707 :

Post by johnlong »

Hi

Answer says : All modification operations of a CopyOnWriteArrayList are considered atomic.
Just to clarify - all modifications ( i.e. add() ) or modifications that write multiple elements (i.e. addAll() ) will be atomic?

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

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

Post by admin »

Yes, that is correct.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong »

Sorry, which statement is correct?

a) all modifications ( i.e. add() )
or
b) modifications that write multiple elements (i.e. addAll() )

I believe it is option b only.

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

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

Post by admin »

Well, all modifications include all modifications even though it doesn't make much sense for a single modification. A single modification is, nevertheless, atomic.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong »

But batch of single modifications run from one method would not block, correct?

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

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

Post by admin »

Not sure what you mean. Please post code.

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests