Package org.apache.hadoop.service
Class ServiceStateException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.apache.hadoop.service.ServiceStateException
- All Implemented Interfaces:
Serializable,org.apache.hadoop.util.ExitCodeProvider
@Public
@Evolving
public class ServiceStateException
extends RuntimeException
implements org.apache.hadoop.util.ExitCodeProvider
Exception that can be raised on state change operations, whose
exit code can be explicitly set, determined from that of any nested
cause, or a default value of
LauncherExitCodes.EXIT_SERVICE_LIFECYCLE_EXCEPTION.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionServiceStateException(int exitCode, String message, Throwable cause) Instantiate, using the specified exit code as the exit code of the exception, irrespetive of any exit code supplied by any inner cause.ServiceStateException(String message) InstantiateServiceStateException(String message, Throwable cause) Instantiate with a message and cause; if the cause has an exit code then it is used, otherwise the genericLauncherExitCodes.EXIT_SERVICE_LIFECYCLE_EXCEPTIONexit code is used.ServiceStateException(Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptionstatic RuntimeExceptionConvert any exception into aRuntimeException.static RuntimeExceptionConvert any exception into aRuntimeException.intMethod to get the exit code.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ServiceStateException
Instantiate- Parameters:
message- error message
-
ServiceStateException
Instantiate with a message and cause; if the cause has an exit code then it is used, otherwise the genericLauncherExitCodes.EXIT_SERVICE_LIFECYCLE_EXCEPTIONexit code is used.- Parameters:
message- exception messagecause- optional inner cause
-
ServiceStateException
Instantiate, using the specified exit code as the exit code of the exception, irrespetive of any exit code supplied by any inner cause.- Parameters:
exitCode- exit code to declaremessage- exception messagecause- inner cause
-
ServiceStateException
-
-
Method Details
-
getExitCode
public int getExitCode()Description copied from interface:org.apache.hadoop.util.ExitCodeProviderMethod to get the exit code.- Specified by:
getExitCodein interfaceorg.apache.hadoop.util.ExitCodeProvider- Returns:
- the exit code
-
convert
Convert any exception into aRuntimeException. All other exception types are wrapped in a new instance ofServiceStateException.- Parameters:
fault- exception or throwable- Returns:
- a
RuntimeExceptionto rethrow
-
convert
Convert any exception into aRuntimeException. If the caught exception is already of that type, it is typecast to aRuntimeExceptionand returned. All other exception types are wrapped in a new instance ofServiceStateException.- Parameters:
text- text to use if a new exception is createdfault- exception or throwable- Returns:
- a
RuntimeExceptionto rethrow
-