Package io.grpc.internal
Enum GrpcUtil.Http2Error
- java.lang.Object
-
- java.lang.Enum<GrpcUtil.Http2Error>
-
- io.grpc.internal.GrpcUtil.Http2Error
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<GrpcUtil.Http2Error>
- Enclosing class:
- GrpcUtil
public static enum GrpcUtil.Http2Error extends java.lang.Enum<GrpcUtil.Http2Error>
All error codes identified by the HTTP/2 spec. Used in GOAWAY and RST_STREAM frames.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CANCEL
COMPRESSION_ERROR
CONNECT_ERROR
ENHANCE_YOUR_CALM
FLOW_CONTROL_ERROR
FRAME_SIZE_ERROR
HTTP_1_1_REQUIRED
INADEQUATE_SECURITY
INTERNAL_ERROR
NO_ERROR
Servers implementing a graceful shutdown of the connection will sendGOAWAY
withNO_ERROR
.PROTOCOL_ERROR
REFUSED_STREAM
SETTINGS_TIMEOUT
STREAM_CLOSED
-
Field Summary
Fields Modifier and Type Field Description private int
code
private static GrpcUtil.Http2Error[]
codeMap
private Status
status
-
Constructor Summary
Constructors Modifier Constructor Description private
Http2Error(int code, Status status)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static GrpcUtil.Http2Error[]
buildHttp2CodeMap()
long
code()
Gets the code for this error used on the wire.static GrpcUtil.Http2Error
forCode(long code)
Looks up the HTTP/2 error code enum value for the specified code.Status
status()
Gets theStatus
associated with this HTTP/2 code.static Status
statusForCode(long code)
Looks up theStatus
from the given HTTP/2 error code.static GrpcUtil.Http2Error
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static GrpcUtil.Http2Error[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NO_ERROR
public static final GrpcUtil.Http2Error NO_ERROR
Servers implementing a graceful shutdown of the connection will sendGOAWAY
withNO_ERROR
. In this case it is important to indicate to the application that the request should be retried (i.e.Status.UNAVAILABLE
).
-
PROTOCOL_ERROR
public static final GrpcUtil.Http2Error PROTOCOL_ERROR
-
INTERNAL_ERROR
public static final GrpcUtil.Http2Error INTERNAL_ERROR
-
FLOW_CONTROL_ERROR
public static final GrpcUtil.Http2Error FLOW_CONTROL_ERROR
-
SETTINGS_TIMEOUT
public static final GrpcUtil.Http2Error SETTINGS_TIMEOUT
-
STREAM_CLOSED
public static final GrpcUtil.Http2Error STREAM_CLOSED
-
FRAME_SIZE_ERROR
public static final GrpcUtil.Http2Error FRAME_SIZE_ERROR
-
REFUSED_STREAM
public static final GrpcUtil.Http2Error REFUSED_STREAM
-
CANCEL
public static final GrpcUtil.Http2Error CANCEL
-
COMPRESSION_ERROR
public static final GrpcUtil.Http2Error COMPRESSION_ERROR
-
CONNECT_ERROR
public static final GrpcUtil.Http2Error CONNECT_ERROR
-
ENHANCE_YOUR_CALM
public static final GrpcUtil.Http2Error ENHANCE_YOUR_CALM
-
INADEQUATE_SECURITY
public static final GrpcUtil.Http2Error INADEQUATE_SECURITY
-
HTTP_1_1_REQUIRED
public static final GrpcUtil.Http2Error HTTP_1_1_REQUIRED
-
-
Field Detail
-
codeMap
private static final GrpcUtil.Http2Error[] codeMap
-
code
private final int code
-
status
private final Status status
-
-
Constructor Detail
-
Http2Error
private Http2Error(int code, Status status)
-
-
Method Detail
-
values
public static GrpcUtil.Http2Error[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (GrpcUtil.Http2Error c : GrpcUtil.Http2Error.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static GrpcUtil.Http2Error valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
buildHttp2CodeMap
private static GrpcUtil.Http2Error[] buildHttp2CodeMap()
-
code
public long code()
Gets the code for this error used on the wire.
-
forCode
public static GrpcUtil.Http2Error forCode(long code)
Looks up the HTTP/2 error code enum value for the specified code.- Parameters:
code
- an HTTP/2 error code value.- Returns:
- the HTTP/2 error code enum or
null
if not found.
-
statusForCode
public static Status statusForCode(long code)
Looks up theStatus
from the given HTTP/2 error code. This is preferred overforCode(code).status()
, to more easily conform to HTTP/2:Unknown or unsupported error codes MUST NOT trigger any special behavior. These MAY be treated by an implementation as being equivalent to INTERNAL_ERROR.
- Parameters:
code
- the HTTP/2 error code.- Returns:
- a
Status
representing the given error.
-
-