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;
|
package io.grpc.netty;
|
||||||
|
|
||||||
import io.grpc.Internal;
|
import io.grpc.Internal;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.handler.codec.http2.Http2ConnectionHandler;
|
import io.netty.handler.codec.http2.Http2ConnectionHandler;
|
||||||
import io.netty.util.AsciiString;
|
import io.netty.util.AsciiString;
|
||||||
|
|
||||||
|
|
@ -44,11 +44,8 @@ public interface ProtocolNegotiator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Netty handler to control the protocol negotiation.
|
* 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}.
|
* The HTTP/2 scheme to be used when sending {@code HEADERS}.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -89,30 +89,20 @@ public final class ProtocolNegotiators {
|
||||||
return new ProtocolNegotiator() {
|
return new ProtocolNegotiator() {
|
||||||
@Override
|
@Override
|
||||||
public Handler newHandler(final Http2ConnectionHandler handler) {
|
public Handler newHandler(final Http2ConnectionHandler handler) {
|
||||||
return new Handler() {
|
class PlaintextHandler extends ChannelDuplexHandler implements Handler {
|
||||||
@Override
|
@Override
|
||||||
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
|
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
|
||||||
// Just replace this handler with the gRPC handler.
|
// Just replace this handler with the gRPC handler.
|
||||||
ctx.pipeline().replace(this, null, 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
|
@Override
|
||||||
public AsciiString scheme() {
|
public AsciiString scheme() {
|
||||||
return Utils.HTTP;
|
return Utils.HTTP;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
return new PlaintextHandler();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue