# 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
Description
`static final Consumer<Integer>`
`LOG_ONLY`
No-op strategy, useful for tests.
`static final Consumer<Integer>`
`SYSTEM_EXIT`
Default strategy for shutting down the JVM.

## Method Summary

Modifier and Type
Method
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 Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### 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 Details

### 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`