Class ServiceUtils


  • public abstract class ServiceUtils
    extends java.lang.Object
    Utilities for service management.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.function.Consumer<java.lang.Integer> LOG_ONLY
      No-op strategy, useful for tests.
      static java.util.function.Consumer<java.lang.Integer> SYSTEM_EXIT
      Default strategy for shutting down the JVM.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void requestSystemExit​(int code)
      Force shutdown of the JVM using System.exit.
      static void setSystemExitProcedure​(java.util.function.Consumer<java.lang.Integer> systemExitProcedure)
      Override system callback.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SYSTEM_EXIT

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

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

      • setSystemExitProcedure

        public static void setSystemExitProcedure​(java.util.function.Consumer<java.lang.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