mirror of https://github.com/grpc/grpc-java.git
Remove deprecated call and TODO in Protocol negotiators
This commit is contained in:
parent
e61e6c27ad
commit
04a6c8395b
|
|
@ -32,7 +32,7 @@
|
|||
package io.grpc.netty;
|
||||
|
||||
import io.grpc.Internal;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelInboundHandler;
|
||||
import io.netty.handler.codec.http2.Http2ConnectionHandler;
|
||||
import io.netty.util.AsciiString;
|
||||
|
||||
|
|
@ -44,11 +44,8 @@ public interface ProtocolNegotiator {
|
|||
|
||||
/**
|
||||
* The Netty handler to control the protocol negotiation.
|
||||
*
|
||||
* <p>TODO(carl-mastrangelo): Replace ChannelHandler with ChannelInboundHandler or
|
||||
* ChannelOutboundHandler, since exceptionCaught is deprecated.
|
||||
*/
|
||||
interface Handler extends ChannelHandler {
|
||||
interface Handler extends ChannelInboundHandler {
|
||||
/**
|
||||
* The HTTP/2 scheme to be used when sending {@code HEADERS}.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -89,30 +89,20 @@ public final class ProtocolNegotiators {
|
|||
return new ProtocolNegotiator() {
|
||||
@Override
|
||||
public Handler newHandler(final Http2ConnectionHandler handler) {
|
||||
return new Handler() {
|
||||
class PlaintextHandler extends ChannelDuplexHandler implements Handler {
|
||||
@Override
|
||||
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
|
||||
// Just replace this handler with the gRPC handler.
|
||||
ctx.pipeline().replace(this, null, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
||||
// Don't care.
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
// Should never happen.
|
||||
ctx.fireExceptionCaught(cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsciiString scheme() {
|
||||
return Utils.HTTP;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return new PlaintextHandler();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue