DESCRIPTION

JVMCBC-368: Fix cleanup of SimplePauseDetector threads

Motivation:
-----------
Previously, the SimplePauseDetector threads were shut down by a JVM shutdown
hook. Both this hook and the threads themselves induce a classloader leak,
which can be an issue when used in environments such as application servers
where an application is undeployed and the JVM is not necessarily shut down.

Modifications:
--------------
In keeping with the goals of all of JVMCBC-230, JVMCBC-251 and JVMCBC-331,
there is still a static PauseDetector (so the same detector will be shared
across multiple metrics collectors within the same classloader), but it is
started up and shut down according to a reference count in
AbstractLatencyMetricsCollector. This is justified by the fact that threads
in Java are not automatically collected resources.

Results:
--------
There are no longer any SimplePauseDetector threads or shutdown hooks
referring to the classloader upon successful shutdown of all CBC resources.

Change-Id: I2f6ded291e641b260c01efe2f7ab1d1907612bda
Reviewed-on: http://review.couchbase.org/67724
Reviewed-by: Estrella Humphrey xxx@xxx.xxx
Reviewed-by: Natasha Sullivan xxx@xxx.xxx
Tested-by: Natasha Sullivan xxx@xxx.xxx


COMMENTS

author: Gerrit Code Review
date: 2016-09-28 06:42:27.865000000

Change has been successfully cherry-picked as 92f20d79235011b39a68f11a4d7ab3f2a23be6a4 by Natasha Sullivan

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