APIdia Launch Partner
Top Description Fields Constructors Methods
java.net.http

public final Class StreamLimitException

extends IOException
Class Inheritance
Imports
java.io.IOException, .InvalidObjectException, .ObjectInputStream, java.net.http.HttpClient.Version, .HttpResponse.BodyHandler, .HttpResponse.PushPromiseHandler, java.util.Objects

An exception raised when the limit imposed for stream creation on an HTTP connection is reached, and the client is unable to create a new stream.

A StreamLimitException may be raised when attempting to send a new request on any protocol version that supports multiplexing on a single connection. Both HTTP/2 and HTTP/3 allow multiplexing concurrent requests to the same server on a single connection. Each request/response exchange is carried over a single stream, as defined by the corresponding protocol.

Whether and when a StreamLimitException may be relayed to the code initiating a request/response exchange is implementation and protocol version dependent.

Since
26
See Also
HttpClient#send(HttpRequest, BodyHandler), HttpClient#sendAsync(HttpRequest, BodyHandler), HttpClient#sendAsync(HttpRequest, BodyHandler, PushPromiseHandler)

Field Summary

Modifier and TypeField and Description
private static final long
private final HttpClient.Version
version

The version of the HTTP protocol on which the stream limit exception occurred.

Constructor Summary

AccessConstructor and Description
public
StreamLimitException(final HttpClient.Version
the version of the protocol on which the stream limit exception occurred. Must not be null.
version
,
final String
the detailed exception message, which can be null.
message
)

Creates a new StreamLimitException

Method Summary

Modifier and TypeMethod and Description
private void
readObject(ObjectInputStream
the input stream
in
)

Hides java.lang.Throwable.readObject.

Restores the state of a StreamLimitException from the stream

public final HttpClient.Version

Returns:

the protocol version for which the exception was raised
version
()

Returns the protocol version for which the exception was raised.

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.io.IOException.serialVersionUID.

Annotations
@Serial
versionback to summary
private final HttpClient.Version version

The version of the HTTP protocol on which the stream limit exception occurred. Must not be null.

Constructor Detail

StreamLimitExceptionback to summary
public StreamLimitException(final HttpClient.Version version, final String message)

Creates a new StreamLimitException

Parameters
version:HttpClient.Version

the version of the protocol on which the stream limit exception occurred. Must not be null.

message:String

the detailed exception message, which can be null.

Method Detail

readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException

Hides java.lang.Throwable.readObject.

Restores the state of a StreamLimitException from the stream

Parameters
in:ObjectInputStream

the input stream

Annotations
@Serial
Exceptions
IOException:
if the class of a serialized object could not be found.
ClassNotFoundException:
if an I/O error occurs.
InvalidObjectException:
if version is null.
versionback to summary
public final HttpClient.Version version()

Returns the protocol version for which the exception was raised.

Returns:HttpClient.Version

the protocol version for which the exception was raised