Class ServiceUtils


  • public abstract class ServiceUtils
    extends Object
    Utilities for service management.
    • Field Detail

      • SYSTEM_EXIT

        public static final Consumer<Integer> SYSTEM_EXIT
        Default strategy for shutting down the JVM.
      • LOG_ONLY

        public static final Consumer<Integer> LOG_ONLY
        No-op strategy, useful for tests.
    • Method Detail

      • setSystemExitProcedure

        public static void setSystemExitProcedure​(Consumer<Integer> systemExitProcedure)
        Override system callback. Useful for preventing the JVM to exit in tests or in applications that are running an in-process ZooKeeper server.
        Parameters:
        systemExitProcedure -
      • requestSystemExit

        public static void requestSystemExit​(int code)
        Force shutdown of the JVM using System.exit.
        Parameters:
        code - the exit code
        See Also:
        ExitCode