@InterfaceAudience.LimitedPrivate(value={"HDFS","MapReduce"}) @InterfaceStability.Unstable public final class ExitUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ExitUtil.ExitException |
static class |
ExitUtil.HaltException |
Constructor and Description |
---|
ExitUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
disableSystemExit()
Disable the use of System.exit for testing.
|
static void |
disableSystemHalt()
Disable the use of
Runtime.getRuntime().halt() for testing. |
static ExitUtil.ExitException |
getFirstExitException() |
static ExitUtil.HaltException |
getFirstHaltException() |
static void |
halt(int status)
Forcibly terminates the currently running Java virtual machine.
|
static void |
halt(int status,
String msg)
Forcibly terminates the currently running Java virtual machine.
|
static void |
halt(int status,
Throwable t)
Forcibly terminates the currently running Java virtual machine.
|
static boolean |
haltCalled() |
static void |
resetFirstExitException()
Reset the tracking of process termination.
|
static void |
resetFirstHaltException() |
static void |
terminate(int status)
Like
terminate(int, String) without a message. |
static void |
terminate(int status,
String msg)
Terminate the current process.
|
static void |
terminate(int status,
Throwable t)
Like
terminate(int, String) but uses the given throwable to
initialize the ExitException. |
static boolean |
terminateCalled() |
public static void disableSystemExit()
public static void disableSystemHalt()
Runtime.getRuntime().halt()
for testing.public static boolean terminateCalled()
public static boolean haltCalled()
public static ExitUtil.ExitException getFirstExitException()
public static ExitUtil.HaltException getFirstHaltException()
HaltException
thrown, null if none thrown yetpublic static void resetFirstExitException()
public static void resetFirstHaltException()
public static void terminate(int status, String msg) throws ExitUtil.ExitException
status
- exit codemsg
- message used to create the ExitException
ExitUtil.ExitException
- if System.exit is disabled for test purposespublic static void halt(int status, String msg) throws ExitUtil.HaltException
status
- exit codemsg
- message used to create the HaltException
ExitUtil.HaltException
- if Runtime.getRuntime().halt() is disabled for test purposespublic static void terminate(int status, Throwable t) throws ExitUtil.ExitException
terminate(int, String)
but uses the given throwable to
initialize the ExitException.status
- t
- throwable used to create the ExitExceptionExitUtil.ExitException
- if System.exit is disabled for test purposespublic static void halt(int status, Throwable t) throws ExitUtil.HaltException
status
- t
- ExitUtil.ExitException
ExitUtil.HaltException
public static void terminate(int status) throws ExitUtil.ExitException
terminate(int, String)
without a message.status
- ExitUtil.ExitException
- if System.exit is disabled for test purposespublic static void halt(int status) throws ExitUtil.HaltException
status
- ExitUtil.ExitException
ExitUtil.HaltException
Copyright © 2013 Apache Software Foundation. All rights reserved.