Package org.apache.zookeeper.util
Class ServiceUtils
- java.lang.Object
-
- org.apache.zookeeper.util.ServiceUtils
-
public abstract class ServiceUtils extends java.lang.ObjectUtilities for service management.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.function.Consumer<java.lang.Integer>LOG_ONLYNo-op strategy, useful for tests.static java.util.function.Consumer<java.lang.Integer>SYSTEM_EXITDefault strategy for shutting down the JVM.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidrequestSystemExit(int code)Force shutdown of the JVM using System.exit.static voidsetSystemExitProcedure(java.util.function.Consumer<java.lang.Integer> systemExitProcedure)Override system callback.
-
-
-
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
-
-