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


COMMENTS

author: Natasha Sullivan
date: 2017-03-28 09:21:57.070000000

Uploaded patch set 2.

-------------------------------------
author: Natasha Sullivan
date: 2017-03-28 09:26:40.019000000

Patch Set 2: Verified+1

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