add shutdown hook to shutdown a service; services to invoke
-----------------------------------------------------------
Key: MAPREDUCE-3886
URL: https://issues.apache.org/jira/browse/MAPREDUCE-3886
Project: Hadoop Map/Reduce
Issue Type: Improvement
Components: mrv2
Affects Versions: 0.23.0, 0.24.0
Reporter: Steve Loughran
Currently the services (and their examples) don't handle KILL signals, because
they don't register a shutdown hook. This means that they can't be shut down
cleanly from a console without executing the service-specific commands.
Fix: add a class that takes a weak ref to a service and which registers a
shutdown hook to call Service.stop on that service; catches and ignores any
exceptions in the process.
The abstract service should create an register a service on service start
(unless told not to), and unregister it on service stop(). This would
automatically give all services the desired behaviour.
Composite services may not need this; it may be best to make registration an
option that subclasses explicitly invoke in their service start methods, so
only the key services get this feature.
coding: straightforward
testing: manual only; kill processes by hand and look at the logs
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira