DESCRIPTION

JVMCBC-407: Clean up stateful resources on ConfigurationProvider termination.

Motivation
----------
It has been observed that when a Cluster instance is created and deleted many
times in a row, a memory leak shows up which can be characterized as the
following:

The CarrierRefresher subscribes to the 10 second config polling interval
but never unsubsribes it on shutdown. This has no consequences if, in
regular use, only one Cluster instance is created and terminated
on shutdown, but if it is cycled many times one can observe the increased
memory usage in a profiler.

Modifications
-------------
Since right now there has been no coordinated shutdown of attached
ConfigurationProvider resources, a new shutdown method has been added
which in turn closes the config subject as well as coordinates a
shutdown with the refreshers. This gives every component that
holds global state a chance to clean them up.

Result
------
Resources are properly cleaned up on config provider shutdown, not
leaking memory if they are cycled very often.

Change-Id: I82a5fa193ffefec41c06e89f5eb269858753c4d2
Reviewed-on: http://review.couchbase.org/75858
Tested-by: Natasha Sullivan xxx@xxx.xxx
Reviewed-by: Cory Peck xxx@xxx.xxx
Reviewed-by: Marques Ellis xxx@xxx.xxx


COMMENTS

author: Natasha Sullivan
date: 2017-03-29 09:19:05.062000000

Change has been successfully cherry-picked as a06b6a293feb05c15d1491687ea4d77189a73833 by Natasha Sullivan

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