DESCRIPTION

JVMCBC-201: shutdown coreScheduler properly

Motivation
----------
As described in JCBC-773, when a DefaultCoreEnvironment without custom
ioPool nor coreScheduler is shutdown(), the coreScheduler threads are
not killed. This can lead to a thread growth when creating and closing
multiple environments.

Also, the ioPool is cleaned up even if it was user-provided, which isn't
good since user-provided ioPool could be reused somewhere else. The user
should be in charge of cleaning it in this case.

Modifications
-------------
Added a ShutdownHook interface.

IoPool and CoreScheduler have their own implementation of ShutdownHook,
which gets called when said resources have been constructed by the env,
not provided by the user.

When providing a custom ioPool or scheduler, the user is encouraged to
also provide a corresponding ShutdownHook (the builder setter without a
hook is deprecated).

Shutdown result will be reduced from the ShutdownHooks of ioPool and
scheduler, if any.

The shutdown field in DefaultCoreScheduler was never set to true and as
such has been removed.

Added unit test to detect thread count growth in a uncustomized env.

Result
------
Internal SDK threads instanciated by it are now properly killed once the
shutdown() method is called.

Change-Id: Idd38b59f9b521e8db5afb100bc41b1a5b1ac6776


COMMENTS

author: Estrella Humphrey
date: 2015-05-22 16:40:09.250000000

Uploaded patch set 2.

-------------------------------------
author: Estrella Humphrey
date: 2015-05-22 16:42:55.841000000

Patch Set 2: Verified+1

-------------------------------------
author: Natasha Sullivan
date: 2015-05-28 07:08:21.915000000

Patch Set 2: Code-Review+2

-------------------------------------
author: Gerrit Code Review
date: 2015-05-28 07:59:00.391000000

Change has been successfully cherry-picked as b087250954a9b8bd83753e342009069783641fb9

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