shutdown hook: refactor to restrict sun.misc import to StopHandler only

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>