Enum Class CommandErrorCode
- All Implemented Interfaces:
Serializable,Comparable<CommandErrorCode>,Constable
The kinds of failure a
CommandDispatchReply can report, and the classification a receiving member needs to
reconstruct an equivalent exception.
Failures cross the wire as a code rather than a serialized exception. Serializing exceptions would couple both ends to the same classes and versions, and would make the reply format a deserialization surface. A code plus a message conveys what the dispatching side actually needs: which kind of failure occurred, and whether retrying it can help.
- Since:
- 5.4.0
- Author:
- Allard Buijze
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe command reached the receiving member but never reached a handler there — it could not be read, for instance.The handler on the receiving member threw.The handler on the receiving member threw an exception it marked as non-transient.The receiving member had no handler for the command. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandErrorCodeClassifies the givencause, raised while receiving or handling a command, into the code to report it under.static CommandErrorCodeReturns the enum constant of this class with the specified name.static CommandErrorCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NO_HANDLER_FOR_COMMAND
The receiving member had no handler for the command. Reconstructed as aNoHandlerForCommandException, which is transient: the handler may yet appear, for instance because the member is still starting up. -
COMMAND_EXECUTION_ERROR
The handler on the receiving member threw. Reconstructed as aCommandExecutionExceptionwrapping a transientRemoteHandlingException, so aRetrySchedulermay retry it. -
COMMAND_EXECUTION_NON_TRANSIENT_ERROR
The handler on the receiving member threw an exception it marked as non-transient. Reconstructed as aCommandExecutionExceptionwrapping aRemoteNonTransientHandlingException, so aRetrySchedulerdoes not retry it. -
COMMAND_DISPATCH_ERROR
The command reached the receiving member but never reached a handler there — it could not be read, for instance. Reconstructed as aCommandDispatchException.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
classify
Classifies the givencause, raised while receiving or handling a command, into the code to report it under.The two specific kinds are recognised first, because both say something the generic execution codes do not: no handler exists yet, and the command never reached a handler at all. Only what is left is an execution failure, split by whether the application declared it worth retrying.
- Parameters:
cause- the exception raised while receiving or handling a command- Returns:
NO_HANDLER_FOR_COMMANDwhen no handler was found,COMMAND_DISPATCH_ERRORwhen the command never reached a handler,COMMAND_EXECUTION_NON_TRANSIENT_ERRORwhen the givencauseis explicitly non-transient, andCOMMAND_EXECUTION_ERRORotherwise
-