Example usage for io.netty.handler.codec.http2 Http2Exception shutdownHint

List of usage examples for io.netty.handler.codec.http2 Http2Exception shutdownHint

Introduction

In this page you can find the example usage for io.netty.handler.codec.http2 Http2Exception shutdownHint.

Prototype

ShutdownHint shutdownHint

To view the source code for io.netty.handler.codec.http2 Http2Exception shutdownHint.

Click Source Link

Usage

From source file:com.linecorp.armeria.common.http.AbstractHttpToHttp2ConnectionHandler.java

License:Apache License

@Override
protected void onConnectionError(ChannelHandlerContext ctx, Throwable cause, Http2Exception http2Ex) {
    if (handlingConnectionError) {
        return;/*from  w  w  w  . j  a  v a 2 s .  co  m*/
    }

    handlingConnectionError = true;

    // TODO(trustin): Remove this once Http2ConnectionHandler.goAway() sends better debugData.
    //                See https://github.com/netty/netty/issues/5160
    if (http2Ex == null) {
        http2Ex = new Http2Exception(INTERNAL_ERROR, goAwayDebugData(null, cause), cause);
    } else if (http2Ex instanceof ClosedStreamCreationException) {
        final ClosedStreamCreationException e = (ClosedStreamCreationException) http2Ex;
        http2Ex = new ClosedStreamCreationException(e.error(), goAwayDebugData(e, cause), cause);
    } else {
        http2Ex = new Http2Exception(http2Ex.error(), goAwayDebugData(http2Ex, cause), cause,
                http2Ex.shutdownHint());
    }

    super.onConnectionError(ctx, cause, http2Ex);
}

From source file:com.linecorp.armeria.internal.AbstractHttp2ConnectionHandler.java

License:Apache License

@Override
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
        Http2Exception http2Ex) {
    if (handlingConnectionError) {
        return;/*w  w w  .  ja v  a2s. com*/
    }

    handlingConnectionError = true;

    // TODO(trustin): Remove this once Http2ConnectionHandler.goAway() sends better debugData.
    //                See https://github.com/netty/netty/issues/5160
    if (http2Ex == null) {
        http2Ex = new Http2Exception(INTERNAL_ERROR, goAwayDebugData(null, cause), cause);
    } else if (http2Ex instanceof ClosedStreamCreationException) {
        final ClosedStreamCreationException e = (ClosedStreamCreationException) http2Ex;
        http2Ex = new ClosedStreamCreationException(e.error(), goAwayDebugData(e, cause), cause);
    } else {
        http2Ex = new Http2Exception(http2Ex.error(), goAwayDebugData(http2Ex, cause), cause,
                http2Ex.shutdownHint());
    }

    super.onConnectionError(ctx, outbound, cause, http2Ex);
}