ServiceUtils (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.util

## Class ServiceUtils

- java.lang.Object
- - org.apache.zookeeper.util.ServiceUtils

-     public abstract class ServiceUtils
      extends Object

  Utilities for service management.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Consumer<Integer>` | `LOG_ONLY` No-op strategy, useful for tests.
    `static Consumer<Integer>` | `SYSTEM_EXIT` Default strategy for shutting down the JVM.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `requestSystemExit(int code)` Force shutdown of the JVM using System.exit.
    `static void` | `setSystemExitProcedure(Consumer<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 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`

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.