DESCRIPTION

JVMCBC-201: shutdown coreScheduler properly

(backported by cherry pick from commit b087250)

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: I168977822a81207330d2113980621f7deacf9136


COMMENTS

author: Estrella Humphrey
date: 2015-05-29 09:03:45.154000000

Uploaded patch set 1.

-------------------------------------
author: Estrella Humphrey
date: 2015-05-29 09:06:11.256000000

Abandoned

wrong branch

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