Implement process daemonizing for JRuby

This code originates in large parts from the Puma webserver.
See https://github.com/puma/puma. It has been slightly adapted
to fit the sidekiq code but is in and by itself mostly unchanged.