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

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

Introduction

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

Prototype

public static int streamId(Http2Exception e) 

Source Link

Document

Get the stream id associated with an exception.

Usage

From source file:io.grpc.netty.NettyServerHandler.java

License:Apache License

@Override
protected void onStreamError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
        StreamException http2Ex) {/*from  w  ww.  j a v a  2s  .c o m*/
    logger.log(Level.WARNING, "Stream Error", cause);
    NettyServerStream.TransportState serverStream = serverStream(
            connection().stream(Http2Exception.streamId(http2Ex)));
    Tag tag = serverStream != null ? serverStream.tag() : PerfMark.createTag();
    PerfMark.startTask("NettyServerHandler.onStreamError", tag);
    try {
        if (serverStream != null) {
            serverStream.transportReportStatus(Utils.statusFromThrowable(cause));
        }
        // TODO(ejona): Abort the stream by sending headers to help the client with debugging.
        // Delegate to the base class to send a RST_STREAM.
        super.onStreamError(ctx, outbound, cause, http2Ex);
    } finally {
        PerfMark.stopTask("NettyServerHandler.onStreamError", tag);
    }
}