code: public synchronized static void addShutdownHook(Runnable task) {
  		if (task != null) {
  			Runtime.getRuntime().addShutdownHook(new Thread(() -> {
  				try {
  					task.run();
  				}
  				catch (RuntimeException rex) {
  					Say.warn("Exception while processing shutdown-hook", rex);
  				}
  			}));
  		}
  	}
docs: Null-safe shortcut to Runtime method, catching RuntimeExceptions.