DESCRIPTION

JVMCBC-397: Avoid concurrent modification/reading of bucketConfigs map.

Motivation:
-----------
When opening a bucket, the `ClusterConfig` will be modified before performing
`RequestHandler.reconfigure`, which reconfigures all buckets by flatMapping
over an `Observable` that iterates through the `HashMap` in `ClusterConfig`.

This is especially a problem when buckets are opened concurrently, as the
`reconfigure` operation can overlap with the modifications due to opening the
other buckets, leading to a `ConcurrentModificationException` being thrown from
RxJava. Since the modifications aren't synchronised at all, there could
theoretically (though this might be unlikely) be additional problems with
corrupting the internal structure of the HashMap if multiple actual
modifications happen at the same time.

Modifications:
--------------
The `Map` field in `DefaultClusterConfig` is changed to hold a
`ConcurrentHashMap` instead of a `HashMap`.

Results:
--------
No more `ConcurrentModificationException` on reconfiguration, not possible to
have multiple threads modifying a particular `HashMap` at the same time.

Change-Id: Ic72150f5830f15e8ee93d1602b1b220f574a91ea
Reviewed-on: http://review.couchbase.org/73783
Reviewed-by: Natasha Sullivan xxx@xxx.xxx
Tested-by: Natasha Sullivan xxx@xxx.xxx


COMMENTS

author: Natasha Sullivan
date: 2017-02-28 17:20:05.680000000

Change has been successfully cherry-picked as 76d19b33a6f0c51f5317b198defa50feb4556dcc by Natasha Sullivan

-------------------------------------
author: Natasha Sullivan
date: 2017-02-28 17:20:43.032000000

Patch Set 4:

thanks much for your contribution! :)

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