APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.net.http

public abstract sealed Class Http2TerminationCause

extends Object
permits NoError, H2StandardError, InternalError
Class Inheritance
Known Direct Subclasses
jdk.internal.net.http.Http2TerminationCause.NoError, jdk.internal.net.http.Http2TerminationCause.H2StandardError, jdk.internal.net.http.Http2TerminationCause.InternalError
Imports
java.io.IOException, java.net.ProtocolException, java.util.Objects, jdk.internal.net.http.common.Utils, jdk.internal.net.http.frame.ErrorFrame

Termination cause for an HTTP/2 connection

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final int
private String
private final Throwable
private String
private final IOException

Constructor Summary

AccessConstructor and Description
private
Http2TerminationCause(final int closeCode, final Throwable closeCause)

private
Http2TerminationCause(final int closeCode, final String loggedAs)

Method Summary

Modifier and TypeMethod and Description
public static Http2TerminationCause
forException(final Throwable
the termination cause, cannot be null.
cause
)

Returns a connection termination cause that represents an abnormal termination due to the given cause.

public static Http2TerminationCause
forH2Error(final int
the error code
errorCode
,
final String
optional log message to be associated with this termination cause
loggedAs
)

Returns a connection termination cause that represents an abnormal termination due to the given errorCode.

public final IOException
getCloseCause()

Returns the IOException that is considered the cause of the connection termination.

public final int
getCloseCode()

Returns the error code (specified for HTTP/2 ErrorFrame) that caused the connection termination.

public final String
getLogMsg()

Returns the connection termination cause, represented as a string.

public final String
getPeerVisibleReason()

Returns the connection termination cause, represented as a string.

public static Http2TerminationCause
idleTimedOut()

Returns a connection termination cause that represents a normal termination due to the connection being idle.

public abstract boolean
isAbnormalClose()

Returns true if the connection was terminated due to some exception.

public static Http2TerminationCause
noErrorTermination()

Returns a connection termination cause that represents a normal termination.

protected final void
setPeerVisibleReason(final String reasonPhrase)

Sets the connection termination cause, represented as a string, which will be sent to the peer in a GOAWAY frame.

private static IOException
toReportedCause(final Throwable original, final String fallbackExceptionMsg)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closeCodeback to summary
private final int closeCode
logMsgback to summary
private String logMsg
originalCauseback to summary
private final Throwable originalCause
peerVisibleReasonback to summary
private String peerVisibleReason
reportedCauseback to summary
private final IOException reportedCause

Constructor Detail

Http2TerminationCauseback to summary
private Http2TerminationCause(final int closeCode, final Throwable closeCause)
Http2TerminationCauseback to summary
private Http2TerminationCause(final int closeCode, final String loggedAs)

Method Detail

forExceptionback to summary
public static Http2TerminationCause forException(final Throwable cause)

Returns a connection termination cause that represents an abnormal termination due to the given cause.

Parameters
cause:Throwable

the termination cause, cannot be null.

forH2Errorback to summary
public static Http2TerminationCause forH2Error(final int errorCode, final String loggedAs)

Returns a connection termination cause that represents an abnormal termination due to the given errorCode. Although this method does no checks for the errorCode, it is expected to be one of the error codes specified by the HTTP/2 RFC for the ErrorFrame.

Parameters
errorCode:int

the error code

loggedAs:String

optional log message to be associated with this termination cause

getCloseCauseback to summary
public final IOException getCloseCause()

Returns the IOException that is considered the cause of the connection termination. Even a normal termination will have an IOException associated with it, so this method will always return a non-null instance.

getCloseCodeback to summary
public final int getCloseCode()

Returns the error code (specified for HTTP/2 ErrorFrame) that caused the connection termination.

getLogMsgback to summary
public final String getLogMsg()

Returns the connection termination cause, represented as a string. Unlike the peer-visible reason, this log message will not be sent across to the peer and it is thus allowed to include additional details that might help debugging a connection termination.

getPeerVisibleReasonback to summary
public final String getPeerVisibleReason()

Returns the connection termination cause, represented as a string. This represents the "debugData" that is sent to the peer in a GOAWAY frame.

idleTimedOutback to summary
public static Http2TerminationCause idleTimedOut()

Returns a connection termination cause that represents a normal termination due to the connection being idle.

isAbnormalCloseback to summary
public abstract boolean isAbnormalClose()

Returns true if the connection was terminated due to some exception. false otherwise. A normal connection termination (for example, the connection idle timing out locally) is not considered as an abnormal termination and this method returns false for such cases.

noErrorTerminationback to summary
public static Http2TerminationCause noErrorTermination()

Returns a connection termination cause that represents a normal termination.

setPeerVisibleReasonback to summary
protected final void setPeerVisibleReason(final String reasonPhrase)

Sets the connection termination cause, represented as a string, which will be sent to the peer in a GOAWAY frame. Unlike the log message, it is expected that this peer-visible reason will not contain anything that is not meant to be viewed by the peer.

toReportedCauseback to summary
private static IOException toReportedCause(final Throwable original, final String fallbackExceptionMsg)
jdk.internal.net.http back to summary

private sealed Class Http2TerminationCause.H2StandardError

extends Http2TerminationCause
permits ProtocolError
Class Inheritance
Known Direct Subclasses
jdk.internal.net.http.Http2TerminationCause.ProtocolError

Constructor Summary

AccessConstructor and Description
private
H2StandardError(final int errCode, final String msg)

private
H2StandardError(final int errCode, final Throwable cause)

Method Summary

Modifier and TypeMethod and Description
public boolean
isAbnormalClose()

Implements abstract jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Returns true if the connection was terminated due to some exception.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from jdk.internal.net.http.Http2TerminationCause:
forExceptionforH2ErrorgetCloseCausegetCloseCodegetLogMsggetPeerVisibleReasonidleTimedOutnoErrorTerminationsetPeerVisibleReason

Constructor Detail

H2StandardErrorback to summary
private H2StandardError(final int errCode, final String msg)
H2StandardErrorback to summary
private H2StandardError(final int errCode, final Throwable cause)

Method Detail

isAbnormalCloseback to summary
public boolean isAbnormalClose()

Implements abstract jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Doc from jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Returns true if the connection was terminated due to some exception. false otherwise. A normal connection termination (for example, the connection idle timing out locally) is not considered as an abnormal termination and this method returns false for such cases.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
jdk.internal.net.http back to summary

private final Class Http2TerminationCause.InternalError

extends Http2TerminationCause
Class Inheritance

Constructor Summary

AccessConstructor and Description
private
InternalError(final Throwable cause)

Method Summary

Modifier and TypeMethod and Description
public boolean
isAbnormalClose()

Implements abstract jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Returns true if the connection was terminated due to some exception.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from jdk.internal.net.http.Http2TerminationCause:
forExceptionforH2ErrorgetCloseCausegetCloseCodegetLogMsggetPeerVisibleReasonidleTimedOutnoErrorTerminationsetPeerVisibleReason

Constructor Detail

InternalErrorback to summary
private InternalError(final Throwable cause)

Method Detail

isAbnormalCloseback to summary
public boolean isAbnormalClose()

Implements abstract jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Doc from jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Returns true if the connection was terminated due to some exception. false otherwise. A normal connection termination (for example, the connection idle timing out locally) is not considered as an abnormal termination and this method returns false for such cases.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
jdk.internal.net.http back to summary

private final Class Http2TerminationCause.NoError

extends Http2TerminationCause
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final Http2TerminationCause.NoError
private final boolean
private static final Http2TerminationCause.NoError
private static final IOException
private static final IOException

Constructor Summary

AccessConstructor and Description
private
NoError(final boolean idleTimedOut)

Method Summary

Modifier and TypeMethod and Description
public boolean
isAbnormalClose()

Implements abstract jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Returns true if the connection was terminated due to some exception.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from jdk.internal.net.http.Http2TerminationCause:
forExceptionforH2ErrorgetCloseCausegetCloseCodegetLogMsggetPeerVisibleReasonidleTimedOutnoErrorTerminationsetPeerVisibleReason

Field Detail

IDLE_TIMED_OUTback to summary
private static final Http2TerminationCause.NoError IDLE_TIMED_OUT
idleTimedOutback to summary
private final boolean idleTimedOut
INSTANCEback to summary
private static final Http2TerminationCause.NoError INSTANCE
NO_ERROR_IDLE_TIMED_OUT_MARKERback to summary
private static final IOException NO_ERROR_IDLE_TIMED_OUT_MARKER
NO_ERROR_MARKERback to summary
private static final IOException NO_ERROR_MARKER

Constructor Detail

NoErrorback to summary
private NoError(final boolean idleTimedOut)

Method Detail

isAbnormalCloseback to summary
public boolean isAbnormalClose()

Implements abstract jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Doc from jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Returns true if the connection was terminated due to some exception. false otherwise. A normal connection termination (for example, the connection idle timing out locally) is not considered as an abnormal termination and this method returns false for such cases.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
jdk.internal.net.http back to summary

private final Class Http2TerminationCause.ProtocolError

extends H2StandardError
Class Inheritance

Constructor Summary

AccessConstructor and Description
private
ProtocolError(final String msg)

private
ProtocolError(final String msg, final boolean flowControlError)

private

Method Summary

Modifier and TypeMethod and Description
public boolean
isAbnormalClose()

Overrides jdk.internal.net.http.Http2TerminationCause.H2StandardError.isAbnormalClose.

Returns true if the connection was terminated due to some exception.

public String
toString()

Overrides jdk.internal.net.http.Http2TerminationCause.H2StandardError.toString.

Returns a string representation of the object.

Constructor Detail

ProtocolErrorback to summary
private ProtocolError(final String msg)
ProtocolErrorback to summary
private ProtocolError(final String msg, final boolean flowControlError)
ProtocolErrorback to summary
private ProtocolError(final ProtocolException pe)

Method Detail

isAbnormalCloseback to summary
public boolean isAbnormalClose()

Overrides jdk.internal.net.http.Http2TerminationCause.H2StandardError.isAbnormalClose.

Doc from jdk.internal.net.http.Http2TerminationCause.isAbnormalClose.

Returns true if the connection was terminated due to some exception. false otherwise. A normal connection termination (for example, the connection idle timing out locally) is not considered as an abnormal termination and this method returns false for such cases.

Annotations
@Override
toStringback to summary
public String toString()

Overrides jdk.internal.net.http.Http2TerminationCause.H2StandardError.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override