DESCRIPTION

JVMCBC-445: Use an iterator on pool flush to avoid IOOB.

Motivation
----------
In the PooledService flush implementation, we are iterating
the CopyOnWriteArrayList in a simple for loop with direct
index access - this works as long as there is no concurrent
access on the underlying structure.

If this happens, a ArrayIndexOutOfBoundsException is
possible.

Modifications
-------------
To avoid the ArrayIndexOutOfBoundsException, the COWArrayList
provides a stable iterator() which copies the original list
before iterating, preventing the race condition from
happening in the first place.

The changeset uses the iterator approach rather than the
manual indexing.

Result
------
No more ArrayIndexOutOfBoundsException when iterating and
modifying the endpoint list simultaneously.

Change-Id: Ie123d6df31cc00db514630e9b1be0a41b14877f7


COMMENTS

author: Natasha Sullivan
date: 2017-08-08 06:40:31.776000000

Uploaded patch set 1.

-------------------------------------
author: Hugo Blankenship
date: 2017-08-08 06:40:38.030000000

Patch Set 1:

Build Started http://sdkbuilds.sc.couchbase.com/job/couchbase-jvm-core-test/8/

-------------------------------------
