Cleanup usage of Channel*Handler (#9959)

Motivation:

In next major version of netty users should use ChannelHandler everywhere. We should ensure we do the same

Modifications:

Replace usage of deprecated classes / interfaces with ChannelHandler

Result:

Use non-deprecated code
This commit is contained in:
Norman Maurer 2020-01-20 17:47:17 -08:00 committed by GitHub
parent 43cfe26b47
commit 9e29c39daa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
90 changed files with 192 additions and 221 deletions

View File

@ -17,8 +17,8 @@ package io.netty.handler.codec.http;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.util.ReferenceCountUtil; import io.netty.util.ReferenceCountUtil;
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH; import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
@ -44,7 +44,7 @@ import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
* </pre> * </pre>
* </blockquote> * </blockquote>
*/ */
public class HttpServerExpectContinueHandler implements ChannelInboundHandler { public class HttpServerExpectContinueHandler implements ChannelHandler {
private static final FullHttpResponse EXPECTATION_FAILED = new DefaultFullHttpResponse( private static final FullHttpResponse EXPECTATION_FAILED = new DefaultFullHttpResponse(
HTTP_1_1, HttpResponseStatus.EXPECTATION_FAILED, Unpooled.EMPTY_BUFFER); HTTP_1_1, HttpResponseStatus.EXPECTATION_FAILED, Unpooled.EMPTY_BUFFER);

View File

@ -18,14 +18,14 @@ package io.netty.handler.codec.http.websocketx;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.handler.codec.CorruptedFrameException; import io.netty.handler.codec.CorruptedFrameException;
/** /**
* *
*/ */
public class Utf8FrameValidator implements ChannelInboundHandler { public class Utf8FrameValidator implements ChannelHandler {
private int fragmentedFramesCount; private int fragmentedFramesCount;
private Utf8Validator utf8Validator; private Utf8Validator utf8Validator;

View File

@ -16,7 +16,7 @@
package io.netty.handler.codec.http.websocketx; package io.netty.handler.codec.http.websocketx;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpHeaders;
@ -36,7 +36,7 @@ import static io.netty.handler.codec.http.websocketx.WebSocketClientProtocolConf
* This implementation will establish the websocket connection once the connection to the remote server was complete. * This implementation will establish the websocket connection once the connection to the remote server was complete.
* *
* To know once a handshake was done you can intercept the * To know once a handshake was done you can intercept the
* {@link ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object)} and check if the event was of type * {@link ChannelHandler#userEventTriggered(ChannelHandlerContext, Object)} and check if the event was of type
* {@link ClientHandshakeStateEvent#HANDSHAKE_ISSUED} or {@link ClientHandshakeStateEvent#HANDSHAKE_COMPLETE}. * {@link ClientHandshakeStateEvent#HANDSHAKE_ISSUED} or {@link ClientHandshakeStateEvent#HANDSHAKE_COMPLETE}.
*/ */
public class WebSocketClientProtocolHandler extends WebSocketProtocolHandler { public class WebSocketClientProtocolHandler extends WebSocketProtocolHandler {

View File

@ -17,8 +17,8 @@ package io.netty.handler.codec.http.websocketx;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.websocketx.WebSocketClientProtocolHandler.ClientHandshakeStateEvent; import io.netty.handler.codec.http.websocketx.WebSocketClientProtocolHandler.ClientHandshakeStateEvent;
@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
import static io.netty.util.internal.ObjectUtil.*; import static io.netty.util.internal.ObjectUtil.*;
class WebSocketClientProtocolHandshakeHandler implements ChannelInboundHandler { class WebSocketClientProtocolHandshakeHandler implements ChannelHandler {
private static final long DEFAULT_HANDSHAKE_TIMEOUT_MS = 10000L; private static final long DEFAULT_HANDSHAKE_TIMEOUT_MS = 10000L;

View File

@ -17,8 +17,8 @@ package io.netty.handler.codec.http.websocketx;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.util.ReferenceCountUtil; import io.netty.util.ReferenceCountUtil;
import io.netty.util.concurrent.ScheduledFuture; import io.netty.util.concurrent.ScheduledFuture;
@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit;
/** /**
* Send {@link CloseWebSocketFrame} message on channel close, if close frame was not sent before. * Send {@link CloseWebSocketFrame} message on channel close, if close frame was not sent before.
*/ */
final class WebSocketCloseFrameHandler extends ChannelOutboundHandlerAdapter { final class WebSocketCloseFrameHandler implements ChannelHandler {
private final WebSocketCloseStatus closeStatus; private final WebSocketCloseStatus closeStatus;
private final long forceCloseTimeoutMillis; private final long forceCloseTimeoutMillis;
private ChannelPromise closeSent; private ChannelPromise closeSent;
@ -70,7 +70,7 @@ final class WebSocketCloseFrameHandler extends ChannelOutboundHandlerAdapter {
promise = promise.unvoid(); promise = promise.unvoid();
closeSent = promise; closeSent = promise;
} }
super.write(ctx, msg, promise); ctx.write(msg, promise);
} }
private void applyCloseSentTimeout(ChannelHandlerContext ctx) { private void applyCloseSentTimeout(ChannelHandlerContext ctx) {

View File

@ -15,7 +15,7 @@
*/ */
package io.netty.handler.codec.http.websocketx; package io.netty.handler.codec.http.websocketx;
import io.netty.channel.ChannelInboundHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
/** /**
@ -23,5 +23,5 @@ import io.netty.channel.ChannelPipeline;
* *
* This makes it easier to access the added encoder later in the {@link ChannelPipeline}. * This makes it easier to access the added encoder later in the {@link ChannelPipeline}.
*/ */
public interface WebSocketFrameDecoder extends ChannelInboundHandler { public interface WebSocketFrameDecoder extends ChannelHandler {
} }

View File

@ -20,7 +20,6 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.http.DefaultFullHttpResponse; import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.FullHttpRequest;
@ -47,7 +46,7 @@ import static io.netty.handler.codec.http.websocketx.WebSocketServerProtocolConf
* to the <tt>io.netty.example.http.websocketx.server.WebSocketServer</tt> example. * to the <tt>io.netty.example.http.websocketx.server.WebSocketServer</tt> example.
* *
* To know once a handshake was done you can intercept the * To know once a handshake was done you can intercept the
* {@link ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object)} and check if the event was instance * {@link ChannelHandler#userEventTriggered(ChannelHandlerContext, Object)} and check if the event was instance
* of {@link HandshakeComplete}, the event will contain extra information about the handshake such as the request and * of {@link HandshakeComplete}, the event will contain extra information about the handshake such as the request and
* selected subprotocol. * selected subprotocol.
*/ */

View File

@ -17,8 +17,8 @@ package io.netty.handler.codec.http.websocketx;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http.DefaultFullHttpResponse; import io.netty.handler.codec.http.DefaultFullHttpResponse;
@ -42,7 +42,7 @@ import static io.netty.handler.codec.http.HttpVersion.*;
/** /**
* Handles the HTTP handshake (the HTTP Upgrade request) for {@link WebSocketServerProtocolHandler}. * Handles the HTTP handshake (the HTTP Upgrade request) for {@link WebSocketServerProtocolHandler}.
*/ */
class WebSocketServerProtocolHandshakeHandler implements ChannelInboundHandler { class WebSocketServerProtocolHandshakeHandler implements ChannelHandler {
private final WebSocketServerProtocolConfig serverConfig; private final WebSocketServerProtocolConfig serverConfig;
private ChannelHandlerContext ctx; private ChannelHandlerContext ctx;

View File

@ -15,8 +15,8 @@
*/ */
package io.netty.handler.codec.http; package io.netty.handler.codec.http;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.embedded.EmbeddedChannel; import io.netty.channel.embedded.EmbeddedChannel;
import java.util.Collection; import java.util.Collection;
@ -58,7 +58,7 @@ public class HttpClientUpgradeHandlerTest {
} }
} }
private static final class UserEventCatcher implements ChannelInboundHandler { private static final class UserEventCatcher implements ChannelHandler {
private Object evt; private Object evt;
public Object getUserEvent() { public Object getUserEvent() {

View File

@ -18,7 +18,6 @@ package io.netty.handler.codec.http.websocketx;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.channel.embedded.EmbeddedChannel; import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.codec.http.DefaultFullHttpRequest; import io.netty.handler.codec.http.DefaultFullHttpRequest;
@ -391,7 +390,7 @@ public class WebSocketServerProtocolHandlerTest {
} }
} }
private static class CustomTextFrameHandler implements ChannelInboundHandler { private static class CustomTextFrameHandler implements ChannelHandler {
private String content; private String content;
@Override @Override

View File

@ -17,8 +17,8 @@ package io.netty.handler.codec.http2;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.UnsupportedMessageTypeException; import io.netty.handler.codec.UnsupportedMessageTypeException;
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeEvent; import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeEvent;
@ -126,7 +126,7 @@ import static io.netty.handler.codec.http2.Http2Error.NO_ERROR;
* *
* <h3>Error Handling</h3> * <h3>Error Handling</h3>
* *
* Exceptions and errors are propagated via {@link ChannelInboundHandler#exceptionCaught}. Exceptions that apply to * Exceptions and errors are propagated via {@link ChannelHandler#exceptionCaught}. Exceptions that apply to
* a specific HTTP/2 stream are wrapped in a {@link Http2FrameStreamException} and have the corresponding * a specific HTTP/2 stream are wrapped in a {@link Http2FrameStreamException} and have the corresponding
* {@link Http2FrameStream} object attached. * {@link Http2FrameStream} object attached.
* *

View File

@ -15,8 +15,8 @@
*/ */
package io.netty.handler.codec.http2; package io.netty.handler.codec.http2;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.handler.codec.http.FullHttpMessage; import io.netty.handler.codec.http.FullHttpMessage;
import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpScheme; import io.netty.handler.codec.http.HttpScheme;
@ -26,7 +26,7 @@ import io.netty.util.internal.UnstableApi;
* Translates HTTP/1.x object reads into HTTP/2 frames. * Translates HTTP/1.x object reads into HTTP/2 frames.
*/ */
@UnstableApi @UnstableApi
public class InboundHttpToHttp2Adapter implements ChannelInboundHandler { public class InboundHttpToHttp2Adapter implements ChannelHandler {
private final Http2Connection connection; private final Http2Connection connection;
private final Http2FrameListener listener; private final Http2FrameListener listener;

View File

@ -24,7 +24,6 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
@ -520,7 +519,7 @@ public class Http2ConnectionRoundtripTest {
assertTrue(requestLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS)); assertTrue(requestLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
// Add a handler that will immediately throw an exception. // Add a handler that will immediately throw an exception.
clientChannel.pipeline().addFirst(new ChannelHandlerAdapter() { clientChannel.pipeline().addFirst(new ChannelHandler() {
@Override @Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception { public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
throw Http2Exception.connectionError(PROTOCOL_ERROR, "Fake Exception"); throw Http2Exception.connectionError(PROTOCOL_ERROR, "Fake Exception");
@ -702,7 +701,7 @@ public class Http2ConnectionRoundtripTest {
assertTrue(requestLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS)); assertTrue(requestLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
// Add a handler that will immediately throw an exception. // Add a handler that will immediately throw an exception.
clientChannel.pipeline().addFirst(new ChannelHandlerAdapter() { clientChannel.pipeline().addFirst(new ChannelHandler() {
@Override @Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception { public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
throw new RuntimeException("Fake Exception"); throw new RuntimeException("Fake Exception");

View File

@ -21,7 +21,6 @@ import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.channel.WriteBufferWaterMark; import io.netty.channel.WriteBufferWaterMark;
import io.netty.channel.embedded.EmbeddedChannel; import io.netty.channel.embedded.EmbeddedChannel;
@ -137,7 +136,7 @@ public abstract class Http2MultiplexTest<C extends Http2FrameCodec> {
@Test @Test
public void writeUnknownFrame() { public void writeUnknownFrame() {
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter() { Http2StreamChannel childChannel = newOutboundStream(new ChannelHandler() {
@Override @Override
public void channelActive(ChannelHandlerContext ctx) { public void channelActive(ChannelHandlerContext ctx) {
ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers())); ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
@ -185,7 +184,7 @@ public abstract class Http2MultiplexTest<C extends Http2FrameCodec> {
// header frame and unknown frame // header frame and unknown frame
verifyFramesMultiplexedToCorrectChannel(channel, handler, 2); verifyFramesMultiplexedToCorrectChannel(channel, handler, 2);
Channel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter()); Channel childChannel = newOutboundStream(new ChannelHandler() { });
assertTrue(childChannel.isActive()); assertTrue(childChannel.isActive());
} }
@ -299,10 +298,10 @@ public abstract class Http2MultiplexTest<C extends Http2FrameCodec> {
assertNotNull(headersFrame); assertNotNull(headersFrame);
childChannel.config().setAutoRead(false); childChannel.config().setAutoRead(false);
childChannel.pipeline().addFirst(new ChannelInboundHandlerAdapter() { childChannel.pipeline().addFirst(new ChannelHandler() {
private int count; private int count;
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { public void channelRead(ChannelHandlerContext ctx, Object msg) {
ctx.fireChannelRead(msg); ctx.fireChannelRead(msg);
// Close channel after 2 reads so there is still something in the inboundBuffer when the close happens. // Close channel after 2 reads so there is still something in the inboundBuffer when the close happens.
if (++count == 2) { if (++count == 2) {
@ -702,7 +701,7 @@ public abstract class Http2MultiplexTest<C extends Http2FrameCodec> {
@Test @Test
public void writabilityOfParentIsRespected() { public void writabilityOfParentIsRespected() {
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter()); Http2StreamChannel childChannel = newOutboundStream(new ChannelHandler() { });
childChannel.config().setWriteBufferWaterMark(new WriteBufferWaterMark(2048, 4096)); childChannel.config().setWriteBufferWaterMark(new WriteBufferWaterMark(2048, 4096));
parentChannel.config().setWriteBufferWaterMark(new WriteBufferWaterMark(256, 512)); parentChannel.config().setWriteBufferWaterMark(new WriteBufferWaterMark(256, 512));
assertTrue(childChannel.isWritable()); assertTrue(childChannel.isWritable());
@ -1084,11 +1083,11 @@ public abstract class Http2MultiplexTest<C extends Http2FrameCodec> {
frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("bar"), 0, false); frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("bar"), 0, false);
// Add a handler which will request reads. // Add a handler which will request reads.
childChannel.pipeline().addFirst(new ChannelInboundHandlerAdapter() { childChannel.pipeline().addFirst(new ChannelHandler() {
@Override @Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { public void channelReadComplete(ChannelHandlerContext ctx) {
super.channelReadComplete(ctx); ctx.fireChannelReadComplete();
if (triggerOnReadComplete) { if (triggerOnReadComplete) {
ctx.read(); ctx.read();
ctx.read(); ctx.read();

View File

@ -22,7 +22,6 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;

View File

@ -15,18 +15,16 @@
*/ */
package io.netty.handler.codec; package io.netty.handler.codec;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter; import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.util.ReferenceCountUtil; import io.netty.util.ReferenceCountUtil;
import io.netty.util.ReferenceCounted; import io.netty.util.ReferenceCounted;
import io.netty.util.internal.TypeParameterMatcher; import io.netty.util.internal.TypeParameterMatcher;
import java.util.List;
/** /**
* {@link ChannelInboundHandler} which decodes from one message to an other message. * {@link ChannelHandler} which decodes from one message to an other message.
* *
* *
* For example here is an implementation which decodes a {@link String} to an {@link Integer} which represent * For example here is an implementation which decodes a {@link String} to an {@link Integer} which represent
@ -49,7 +47,7 @@ import java.util.List;
* {@link ReferenceCounted#release()} on decoded messages. * {@link ReferenceCounted#release()} on decoded messages.
* *
*/ */
public abstract class MessageToMessageDecoder<I> extends ChannelHandlerAdapter implements ChannelInboundHandler { public abstract class MessageToMessageDecoder<I> extends ChannelHandlerAdapter {
private final TypeParameterMatcher matcher; private final TypeParameterMatcher matcher;
@ -71,7 +69,7 @@ public abstract class MessageToMessageDecoder<I> extends ChannelHandlerAdapter i
/** /**
* Returns {@code true} if the given message should be handled. If {@code false} it will be passed to the next * Returns {@code true} if the given message should be handled. If {@code false} it will be passed to the next
* {@link ChannelInboundHandler} in the {@link ChannelPipeline}. * {@link ChannelHandler} in the {@link ChannelPipeline}.
*/ */
public boolean acceptInboundMessage(Object msg) throws Exception { public boolean acceptInboundMessage(Object msg) throws Exception {
return matcher.match(msg); return matcher.match(msg);

View File

@ -24,9 +24,7 @@ import io.netty.buffer.UnpooledByteBufAllocator;
import io.netty.buffer.UnpooledHeapByteBuf; import io.netty.buffer.UnpooledHeapByteBuf;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.embedded.EmbeddedChannel; import io.netty.channel.embedded.EmbeddedChannel;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
@ -433,13 +431,13 @@ public class ByteToMessageDecoderTest {
@Test @Test
public void testDoesNotOverRead() { public void testDoesNotOverRead() {
class ReadInterceptingHandler extends ChannelOutboundHandlerAdapter { class ReadInterceptingHandler implements ChannelHandler {
private int readsTriggered; private int readsTriggered;
@Override @Override
public void read(ChannelHandlerContext ctx) throws Exception { public void read(ChannelHandlerContext ctx) {
readsTriggered++; readsTriggered++;
super.read(ctx); ctx.read();
} }
} }
ReadInterceptingHandler interceptor = new ReadInterceptingHandler(); ReadInterceptingHandler interceptor = new ReadInterceptingHandler();

View File

@ -17,15 +17,15 @@ package io.netty.example.echo;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
/** /**
* Handler implementation for the echo client. It initiates the ping-pong * Handler implementation for the echo client. It initiates the ping-pong
* traffic between the echo client and server by sending the first message to * traffic between the echo client and server by sending the first message to
* the server. * the server.
*/ */
public class EchoClientHandler implements ChannelInboundHandler { public class EchoClientHandler implements ChannelHandler {
private final ByteBuf firstMessage; private final ByteBuf firstMessage;

View File

@ -15,15 +15,15 @@
*/ */
package io.netty.example.echo; package io.netty.example.echo;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
/** /**
* Handler implementation for the echo server. * Handler implementation for the echo server.
*/ */
@Sharable @Sharable
public class EchoServerHandler implements ChannelInboundHandler { public class EchoServerHandler implements ChannelHandler {
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) { public void channelRead(ChannelHandlerContext ctx, Object msg) {

View File

@ -15,8 +15,8 @@
package io.netty.example.http2.helloworld.client; package io.netty.example.http2.helloworld.client;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
@ -134,7 +134,7 @@ public class Http2ClientInitializer extends ChannelInitializer<SocketChannel> {
/** /**
* A handler that triggers the cleartext upgrade to HTTP/2 by sending an initial HTTP request. * A handler that triggers the cleartext upgrade to HTTP/2 by sending an initial HTTP request.
*/ */
private final class UpgradeRequestHandler implements ChannelInboundHandler { private final class UpgradeRequestHandler implements ChannelHandler {
@Override @Override
public void channelActive(ChannelHandlerContext ctx) throws Exception { public void channelActive(ChannelHandlerContext ctx) throws Exception {
@ -163,7 +163,7 @@ public class Http2ClientInitializer extends ChannelInitializer<SocketChannel> {
/** /**
* Class that logs any User Events triggered on this channel. * Class that logs any User Events triggered on this channel.
*/ */
private static class UserEventLogger implements ChannelInboundHandler { private static class UserEventLogger implements ChannelHandler {
@Override @Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
System.out.println("User Event Triggered: " + evt); System.out.println("User Event Triggered: " + evt);

View File

@ -16,8 +16,8 @@
package io.netty.example.http2.helloworld.frame.server; package io.netty.example.http2.helloworld.frame.server;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleChannelInboundHandler;
@ -108,7 +108,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> {
/** /**
* Class that logs any User Events triggered on this channel. * Class that logs any User Events triggered on this channel.
*/ */
private static class UserEventLogger implements ChannelInboundHandler { private static class UserEventLogger implements ChannelHandler {
@Override @Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
System.out.println("User Event Triggered: " + evt); System.out.println("User Event Triggered: " + evt);

View File

@ -16,8 +16,8 @@
package io.netty.example.http2.helloworld.multiplex.server; package io.netty.example.http2.helloworld.multiplex.server;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleChannelInboundHandler;
@ -110,7 +110,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> {
/** /**
* Class that logs any User Events triggered on this channel. * Class that logs any User Events triggered on this channel.
*/ */
private static class UserEventLogger implements ChannelInboundHandler { private static class UserEventLogger implements ChannelHandler {
@Override @Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
System.out.println("User Event Triggered: " + evt); System.out.println("User Event Triggered: " + evt);

View File

@ -16,8 +16,8 @@
package io.netty.example.http2.helloworld.server; package io.netty.example.http2.helloworld.server;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleChannelInboundHandler;
@ -109,7 +109,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> {
/** /**
* Class that logs any User Events triggered on this channel. * Class that logs any User Events triggered on this channel.
*/ */
private static class UserEventLogger implements ChannelInboundHandler { private static class UserEventLogger implements ChannelHandler {
@Override @Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
System.out.println("User Event Triggered: " + evt); System.out.println("User Event Triggered: " + evt);

View File

@ -15,10 +15,10 @@
*/ */
package io.netty.example.localecho; package io.netty.example.localecho;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
public class LocalEchoServerHandler implements ChannelInboundHandler { public class LocalEchoServerHandler implements ChannelHandler {
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) { public void channelRead(ChannelHandlerContext ctx, Object msg) {

View File

@ -15,9 +15,9 @@
*/ */
package io.netty.example.mqtt.heartBeat; package io.netty.example.mqtt.heartBeat;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.mqtt.MqttConnAckMessage; import io.netty.handler.codec.mqtt.MqttConnAckMessage;
import io.netty.handler.codec.mqtt.MqttConnAckVariableHeader; import io.netty.handler.codec.mqtt.MqttConnAckVariableHeader;
import io.netty.handler.codec.mqtt.MqttConnectReturnCode; import io.netty.handler.codec.mqtt.MqttConnectReturnCode;
@ -30,7 +30,7 @@ import io.netty.handler.timeout.IdleStateEvent;
import io.netty.util.ReferenceCountUtil; import io.netty.util.ReferenceCountUtil;
@Sharable @Sharable
public final class MqttHeartBeatBrokerHandler extends ChannelInboundHandlerAdapter { public final class MqttHeartBeatBrokerHandler implements ChannelHandler {
public static final MqttHeartBeatBrokerHandler INSTANCE = new MqttHeartBeatBrokerHandler(); public static final MqttHeartBeatBrokerHandler INSTANCE = new MqttHeartBeatBrokerHandler();
@ -38,7 +38,7 @@ public final class MqttHeartBeatBrokerHandler extends ChannelInboundHandlerAdapt
} }
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { public void channelRead(ChannelHandlerContext ctx, Object msg) {
MqttMessage mqttMessage = (MqttMessage) msg; MqttMessage mqttMessage = (MqttMessage) msg;
System.out.println("Received MQTT message: " + mqttMessage); System.out.println("Received MQTT message: " + mqttMessage);
switch (mqttMessage.fixedHeader().messageType()) { switch (mqttMessage.fixedHeader().messageType()) {
@ -67,7 +67,7 @@ public final class MqttHeartBeatBrokerHandler extends ChannelInboundHandlerAdapt
} }
@Override @Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
System.out.println("Channel heartBeat lost"); System.out.println("Channel heartBeat lost");
if (evt instanceof IdleStateEvent && IdleState.READER_IDLE == ((IdleStateEvent) evt).state()) { if (evt instanceof IdleStateEvent && IdleState.READER_IDLE == ((IdleStateEvent) evt).state()) {
ctx.close(); ctx.close();
@ -75,7 +75,7 @@ public final class MqttHeartBeatBrokerHandler extends ChannelInboundHandlerAdapt
} }
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace(); cause.printStackTrace();
ctx.close(); ctx.close();
} }

View File

@ -15,8 +15,8 @@
*/ */
package io.netty.example.mqtt.heartBeat; package io.netty.example.mqtt.heartBeat;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.mqtt.MqttConnectMessage; import io.netty.handler.codec.mqtt.MqttConnectMessage;
import io.netty.handler.codec.mqtt.MqttConnectPayload; import io.netty.handler.codec.mqtt.MqttConnectPayload;
import io.netty.handler.codec.mqtt.MqttConnectVariableHeader; import io.netty.handler.codec.mqtt.MqttConnectVariableHeader;
@ -27,7 +27,7 @@ import io.netty.handler.codec.mqtt.MqttQoS;
import io.netty.handler.timeout.IdleStateEvent; import io.netty.handler.timeout.IdleStateEvent;
import io.netty.util.ReferenceCountUtil; import io.netty.util.ReferenceCountUtil;
public class MqttHeartBeatClientHandler extends ChannelInboundHandlerAdapter { public class MqttHeartBeatClientHandler implements ChannelHandler {
private static final String PROTOCOL_NAME_MQTT_3_1_1 = "MQTT"; private static final String PROTOCOL_NAME_MQTT_3_1_1 = "MQTT";
private static final int PROTOCOL_VERSION_MQTT_3_1_1 = 4; private static final int PROTOCOL_VERSION_MQTT_3_1_1 = 4;
@ -71,7 +71,7 @@ public class MqttHeartBeatClientHandler extends ChannelInboundHandlerAdapter {
ctx.writeAndFlush(pingreqMessage); ctx.writeAndFlush(pingreqMessage);
System.out.println("Sent PINGREQ"); System.out.println("Sent PINGREQ");
} else { } else {
super.userEventTriggered(ctx, evt); ctx.fireUserEventTriggered(evt);
} }
} }

View File

@ -15,8 +15,8 @@
*/ */
package io.netty.example.objectecho; package io.netty.example.objectecho;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -26,7 +26,7 @@ import java.util.List;
* ping-pong traffic between the object echo client and server by sending the * ping-pong traffic between the object echo client and server by sending the
* first message to the server. * first message to the server.
*/ */
public class ObjectEchoClientHandler implements ChannelInboundHandler { public class ObjectEchoClientHandler implements ChannelHandler {
private final List<Integer> firstMessage; private final List<Integer> firstMessage;

View File

@ -15,14 +15,14 @@
*/ */
package io.netty.example.objectecho; package io.netty.example.objectecho;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
/** /**
* Handles both client-side and server-side handler depending on which * Handles both client-side and server-side handler depending on which
* constructor was called. * constructor was called.
*/ */
public class ObjectEchoServerHandler implements ChannelInboundHandler { public class ObjectEchoServerHandler implements ChannelHandler {
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) { public void channelRead(ChannelHandlerContext ctx, Object msg) {

View File

@ -22,7 +22,7 @@ import javax.net.ssl.SSLSession;
import javax.security.cert.X509Certificate; import javax.security.cert.X509Certificate;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelInboundHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.MultithreadEventLoopGroup; import io.netty.channel.MultithreadEventLoopGroup;
import io.netty.channel.nio.NioHandler; import io.netty.channel.nio.NioHandler;
import org.bouncycastle.asn1.ocsp.OCSPResponseStatus; import org.bouncycastle.asn1.ocsp.OCSPResponseStatus;
@ -153,7 +153,7 @@ public class OcspClientExample {
}; };
} }
private static class HttpClientHandler implements ChannelInboundHandler { private static class HttpClientHandler implements ChannelHandler {
private final String host; private final String host;

View File

@ -17,10 +17,10 @@ package io.netty.example.proxy;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
public class HexDumpProxyBackendHandler implements ChannelInboundHandler { public class HexDumpProxyBackendHandler implements ChannelHandler {
private final Channel inboundChannel; private final Channel inboundChannel;

View File

@ -20,11 +20,11 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
public class HexDumpProxyFrontendHandler implements ChannelInboundHandler { public class HexDumpProxyFrontendHandler implements ChannelHandler {
private final String remoteHost; private final String remoteHost;
private final int remotePort; private final int remotePort;

View File

@ -17,8 +17,8 @@ package io.netty.example.sctp;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.sctp.SctpMessage; import io.netty.channel.sctp.SctpMessage;
/** /**
@ -26,7 +26,7 @@ import io.netty.channel.sctp.SctpMessage;
* traffic between the echo client and server by sending the first message to * traffic between the echo client and server by sending the first message to
* the server. * the server.
*/ */
public class SctpEchoClientHandler implements ChannelInboundHandler { public class SctpEchoClientHandler implements ChannelHandler {
private final ByteBuf firstMessage; private final ByteBuf firstMessage;

View File

@ -15,15 +15,15 @@
*/ */
package io.netty.example.sctp; package io.netty.example.sctp;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
/** /**
* Handler implementation for the SCTP echo server. * Handler implementation for the SCTP echo server.
*/ */
@Sharable @Sharable
public class SctpEchoServerHandler implements ChannelInboundHandler { public class SctpEchoServerHandler implements ChannelHandler {
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) { public void channelRead(ChannelHandlerContext ctx, Object msg) {

View File

@ -16,11 +16,11 @@
package io.netty.example.socksproxy; package io.netty.example.socksproxy;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.util.concurrent.Promise; import io.netty.util.concurrent.Promise;
public final class DirectClientHandler implements ChannelInboundHandler { public final class DirectClientHandler implements ChannelHandler {
private final Promise<Channel> promise; private final Promise<Channel> promise;

View File

@ -17,11 +17,11 @@ package io.netty.example.socksproxy;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.util.ReferenceCountUtil; import io.netty.util.ReferenceCountUtil;
public final class RelayHandler implements ChannelInboundHandler { public final class RelayHandler implements ChannelHandler {
private final Channel relayChannel; private final Channel relayChannel;

View File

@ -25,7 +25,6 @@ import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop; import io.netty.channel.EventLoop;
@ -229,7 +228,7 @@ abstract class ProxyServer {
ctx.close(); ctx.close();
} }
private final class BackendHandler implements ChannelInboundHandler { private final class BackendHandler implements ChannelHandler {
private final ChannelHandlerContext frontend; private final ChannelHandlerContext frontend;

View File

@ -18,8 +18,8 @@ package io.netty.handler.ipfilter;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import java.net.SocketAddress; import java.net.SocketAddress;
@ -35,7 +35,7 @@ import java.net.SocketAddress;
* flexibility to respond to rejected (denied) connections. If you do not want to send a response, just have it return * flexibility to respond to rejected (denied) connections. If you do not want to send a response, just have it return
* null. Take a look at {@link RuleBasedIpFilter} for details. * null. Take a look at {@link RuleBasedIpFilter} for details.
*/ */
public abstract class AbstractRemoteAddressFilter<T extends SocketAddress> implements ChannelInboundHandler { public abstract class AbstractRemoteAddressFilter<T extends SocketAddress> implements ChannelHandler {
@Override @Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception { public void channelRegistered(ChannelHandlerContext ctx) throws Exception {

View File

@ -20,7 +20,6 @@ import io.netty.buffer.ByteBufHolder;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandler;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.util.internal.logging.InternalLogLevel; import io.netty.util.internal.logging.InternalLogLevel;
import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLogger;
@ -287,7 +286,7 @@ public class LoggingHandler implements ChannelHandler {
/** /**
* Formats an event and returns the formatted message. This method is currently only used for formatting * Formats an event and returns the formatted message. This method is currently only used for formatting
* {@link ChannelOutboundHandler#connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)}. * {@link ChannelHandler#connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)}.
* *
* @param eventName the name of the event * @param eventName the name of the event
* @param firstArg the first argument of the event * @param firstArg the first argument of the event

View File

@ -18,8 +18,8 @@ package io.netty.handler.ssl;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLogger;
@ -60,7 +60,7 @@ import io.netty.util.internal.logging.InternalLoggerFactory;
* } * }
* </pre> * </pre>
*/ */
public abstract class ApplicationProtocolNegotiationHandler implements ChannelInboundHandler { public abstract class ApplicationProtocolNegotiationHandler implements ChannelHandler {
private static final InternalLogger logger = private static final InternalLogger logger =
InternalLoggerFactory.getInstance(ApplicationProtocolNegotiationHandler.class); InternalLoggerFactory.getInstance(ApplicationProtocolNegotiationHandler.class);

View File

@ -16,8 +16,8 @@
package io.netty.handler.ssl; package io.netty.handler.ssl;
import io.netty.buffer.ByteBufUtil; import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.internal.ReflectionUtil; import io.netty.util.internal.ReflectionUtil;
import io.netty.util.internal.SystemPropertyUtil; import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLogger;
@ -35,7 +35,7 @@ import java.lang.reflect.Field;
* This can be very useful, for instance the {@link WiresharkSslMasterKeyHandler} implementation will * This can be very useful, for instance the {@link WiresharkSslMasterKeyHandler} implementation will
* log the secret & identifier in a format that is consumable by Wireshark -- allowing easy decryption of pcap/tcpdumps. * log the secret & identifier in a format that is consumable by Wireshark -- allowing easy decryption of pcap/tcpdumps.
*/ */
public abstract class SslMasterKeyHandler extends ChannelInboundHandlerAdapter { public abstract class SslMasterKeyHandler implements ChannelHandler {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(SslMasterKeyHandler.class); private static final InternalLogger logger = InternalLoggerFactory.getInstance(SslMasterKeyHandler.class);

View File

@ -17,8 +17,8 @@ package io.netty.handler.ssl.ocsp;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.handler.ssl.ReferenceCountedOpenSslContext; import io.netty.handler.ssl.ReferenceCountedOpenSslContext;
import io.netty.handler.ssl.ReferenceCountedOpenSslEngine; import io.netty.handler.ssl.ReferenceCountedOpenSslEngine;
import io.netty.handler.ssl.SslHandshakeCompletionEvent; import io.netty.handler.ssl.SslHandshakeCompletionEvent;
@ -33,7 +33,7 @@ import javax.net.ssl.SSLHandshakeException;
* @see ReferenceCountedOpenSslEngine#getOcspResponse() * @see ReferenceCountedOpenSslEngine#getOcspResponse()
*/ */
@UnstableApi @UnstableApi
public abstract class OcspClientHandler implements ChannelInboundHandler { public abstract class OcspClientHandler implements ChannelHandler {
private final ReferenceCountedOpenSslEngine engine; private final ReferenceCountedOpenSslEngine engine;

View File

@ -18,7 +18,6 @@ package io.netty.handler.traffic;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufHolder; import io.netty.buffer.ByteBufHolder;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;

View File

@ -23,7 +23,6 @@ import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.buffer.UnpooledByteBufAllocator; import io.netty.buffer.UnpooledByteBufAllocator;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
@ -107,7 +106,7 @@ public class SslHandlerTest {
writeLatch.countDown(); writeLatch.countDown();
} }
}; };
EmbeddedChannel ch = new EmbeddedChannel(new ChannelDuplexHandler() { EmbeddedChannel ch = new EmbeddedChannel(new ChannelHandler() {
@Override @Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
if (msg instanceof ByteBuf) { if (msg instanceof ByteBuf) {

View File

@ -21,7 +21,6 @@ import io.netty.buffer.UnpooledByteBufAllocator;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.microbench.channel.EmbeddedChannelWriteReleaseHandlerContext; import io.netty.microbench.channel.EmbeddedChannelWriteReleaseHandlerContext;
import io.netty.microbench.util.AbstractMicrobenchmark; import io.netty.microbench.util.AbstractMicrobenchmark;

View File

@ -25,7 +25,6 @@ import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
@ -1177,7 +1176,7 @@ public class DnsNameResolver extends InetNameResolver {
return dnsServerAddressStreamProvider.nameServerAddressStream(hostname); return dnsServerAddressStreamProvider.nameServerAddressStream(hostname);
} }
private final class DnsResponseHandler implements ChannelInboundHandler { private final class DnsResponseHandler implements ChannelHandler {
private final Promise<Channel> channelActivePromise; private final Promise<Channel> channelActivePromise;

View File

@ -20,8 +20,8 @@ import io.netty.buffer.ByteBufHolder;
import io.netty.channel.AddressedEnvelope; import io.netty.channel.AddressedEnvelope;
import io.netty.channel.ChannelFactory; import io.netty.channel.ChannelFactory;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.EventLoop; import io.netty.channel.EventLoop;
import io.netty.channel.EventLoopGroup; import io.netty.channel.EventLoopGroup;
import io.netty.channel.MultithreadEventLoopGroup; import io.netty.channel.MultithreadEventLoopGroup;
@ -2802,7 +2802,7 @@ public class DnsNameResolverTest {
} }
resolver = builder.build(); resolver = builder.build();
if (truncatedBecauseOfMtu) { if (truncatedBecauseOfMtu) {
resolver.ch.pipeline().addFirst(new ChannelInboundHandlerAdapter() { resolver.ch.pipeline().addFirst(new ChannelHandler() {
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) { public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof DatagramPacket) { if (msg instanceof DatagramPacket) {

View File

@ -19,8 +19,8 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.handler.codec.http.DefaultFullHttpResponse; import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaderNames;
@ -48,7 +48,7 @@ import static io.netty.handler.codec.http.HttpVersion.*;
/** /**
* Handles handshakes and messages * Handles handshakes and messages
*/ */
public class AutobahnServerHandler implements ChannelInboundHandler { public class AutobahnServerHandler implements ChannelHandler {
private static final Logger logger = Logger.getLogger(AutobahnServerHandler.class.getName()); private static final Logger logger = Logger.getLogger(AutobahnServerHandler.class.getName());
private WebSocketServerHandshaker handshaker; private WebSocketServerHandshaker handshaker;

View File

@ -18,8 +18,8 @@ package io.netty.testsuite.http2;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero; import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleChannelInboundHandler;
@ -96,7 +96,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> {
/** /**
* Class that logs any User Events triggered on this channel. * Class that logs any User Events triggered on this channel.
*/ */
private static class UserEventLogger implements ChannelInboundHandler { private static class UserEventLogger implements ChannelHandler {
@Override @Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
System.out.println("User Event Triggered: " + evt); System.out.println("User Event Triggered: " + evt);

View File

@ -22,8 +22,8 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.testsuite.transport.TestsuitePermutation; import io.netty.testsuite.transport.TestsuitePermutation;
@ -110,7 +110,7 @@ public abstract class AbstractSocketReuseFdTest extends AbstractSocketTest {
} }
} }
static class ReuseFdHandler extends ChannelInboundHandlerAdapter { static class ReuseFdHandler implements ChannelHandler {
private static final String EXPECTED_PAYLOAD = "payload"; private static final String EXPECTED_PAYLOAD = "payload";
private final Promise<Void> donePromise; private final Promise<Void> donePromise;

View File

@ -21,7 +21,6 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.testsuite.transport.TestsuitePermutation; import io.netty.testsuite.transport.TestsuitePermutation;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
import io.netty.util.NetUtil; import io.netty.util.NetUtil;

View File

@ -19,7 +19,6 @@ import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.util.internal.SocketUtils; import io.netty.util.internal.SocketUtils;
import org.junit.Ignore; import org.junit.Ignore;
@ -94,7 +93,7 @@ public class ServerSocketSuspendTest extends AbstractServerSocketTest {
} }
@ChannelHandler.Sharable @ChannelHandler.Sharable
private static final class AcceptedChannelCounter implements ChannelInboundHandler { private static final class AcceptedChannelCounter implements ChannelHandler {
final CountDownLatch latch; final CountDownLatch latch;

View File

@ -22,8 +22,8 @@ import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.RecvByteBufAllocator; import io.netty.channel.RecvByteBufAllocator;
@ -116,7 +116,7 @@ public class SocketAutoReadTest extends AbstractSocketTest {
} }
} }
private static final class AutoReadHandler implements ChannelInboundHandler { private static final class AutoReadHandler implements ChannelHandler {
private final AtomicInteger count = new AtomicInteger(); private final AtomicInteger count = new AtomicInteger();
private final CountDownLatch latch = new CountDownLatch(1); private final CountDownLatch latch = new CountDownLatch(1);
private final CountDownLatch latch2; private final CountDownLatch latch2;

View File

@ -17,7 +17,6 @@ package io.netty.testsuite.transport.socket;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import org.junit.Test; import org.junit.Test;

View File

@ -20,7 +20,6 @@ import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import org.junit.Test; import org.junit.Test;

View File

@ -19,8 +19,8 @@ import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
@ -83,7 +83,7 @@ public class SocketExceptionHandlingTest extends AbstractSocketTest {
} }
} }
private static class BuggyChannelHandler implements ChannelInboundHandler { private static class BuggyChannelHandler implements ChannelHandler {
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
ReferenceCountUtil.release(msg); ReferenceCountUtil.release(msg);
@ -91,7 +91,7 @@ public class SocketExceptionHandlingTest extends AbstractSocketTest {
} }
} }
private static class ExceptionHandler implements ChannelInboundHandler { private static class ExceptionHandler implements ChannelHandler {
final AtomicLong count = new AtomicLong(); final AtomicLong count = new AtomicLong();
/** /**
* We expect to get 1 call to {@link #exceptionCaught(ChannelHandlerContext, Throwable)}. * We expect to get 1 call to {@link #exceptionCaught(ChannelHandlerContext, Throwable)}.

View File

@ -18,8 +18,8 @@ package io.netty.testsuite.transport.socket;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.handler.codec.serialization.ClassResolvers; import io.netty.handler.codec.serialization.ClassResolvers;
@ -149,7 +149,7 @@ public class SocketObjectEchoTest extends AbstractSocketTest {
} }
} }
private static class EchoHandler implements ChannelInboundHandler { private static class EchoHandler implements ChannelHandler {
private final boolean autoRead; private final boolean autoRead;
volatile Channel channel; volatile Channel channel;
final AtomicReference<Throwable> exception = new AtomicReference<>(); final AtomicReference<Throwable> exception = new AtomicReference<>();

View File

@ -22,8 +22,8 @@ import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.RecvByteBufAllocator; import io.netty.channel.RecvByteBufAllocator;
@ -101,7 +101,7 @@ public class SocketReadPendingTest extends AbstractSocketTest {
} }
} }
private static final class ReadPendingReadHandler implements ChannelInboundHandler { private static final class ReadPendingReadHandler implements ChannelHandler {
private final AtomicInteger count = new AtomicInteger(); private final AtomicInteger count = new AtomicInteger();
private final CountDownLatch latch = new CountDownLatch(1); private final CountDownLatch latch = new CountDownLatch(1);
private final CountDownLatch latch2 = new CountDownLatch(2); private final CountDownLatch latch2 = new CountDownLatch(2);

View File

@ -17,8 +17,8 @@ package io.netty.testsuite.transport.socket;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import org.junit.Test; import org.junit.Test;
@ -42,7 +42,7 @@ public class WriteBeforeRegisteredTest extends AbstractClientSocketTest {
} }
} }
private static class TestHandler implements ChannelInboundHandler { private static class TestHandler implements ChannelHandler {
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
cause.printStackTrace(); cause.printStackTrace();

View File

@ -21,7 +21,6 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.unix.DomainSocketReadMode; import io.netty.channel.unix.DomainSocketReadMode;
import io.netty.channel.unix.FileDescriptor; import io.netty.channel.unix.FileDescriptor;
import io.netty.testsuite.transport.TestsuitePermutation; import io.netty.testsuite.transport.TestsuitePermutation;

View File

@ -20,9 +20,7 @@ import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler; import io.netty.handler.logging.LoggingHandler;
import io.netty.util.NetUtil; import io.netty.util.NetUtil;
@ -202,7 +200,7 @@ public class EpollReuseAddrTest {
} }
@ChannelHandler.Sharable @ChannelHandler.Sharable
private static class ServerSocketTestHandler implements ChannelInboundHandler { private static class ServerSocketTestHandler implements ChannelHandler {
private final AtomicBoolean accepted; private final AtomicBoolean accepted;
ServerSocketTestHandler(AtomicBoolean accepted) { ServerSocketTestHandler(AtomicBoolean accepted) {
@ -217,7 +215,7 @@ public class EpollReuseAddrTest {
} }
@ChannelHandler.Sharable @ChannelHandler.Sharable
private static class DatagramSocketTestHandler implements ChannelInboundHandler { private static class DatagramSocketTestHandler implements ChannelHandler {
private final AtomicBoolean received; private final AtomicBoolean received;
DatagramSocketTestHandler(AtomicBoolean received) { DatagramSocketTestHandler(AtomicBoolean received) {
@ -232,5 +230,5 @@ public class EpollReuseAddrTest {
} }
@ChannelHandler.Sharable @ChannelHandler.Sharable
private static final class DummyHandler extends ChannelHandlerAdapter { } private static final class DummyHandler implements ChannelHandler { }
} }

View File

@ -18,7 +18,6 @@ package io.netty.channel.kqueue;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelException; import io.netty.channel.ChannelException;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup; import io.netty.channel.EventLoopGroup;
import io.netty.channel.MultithreadEventLoopGroup; import io.netty.channel.MultithreadEventLoopGroup;

View File

@ -21,7 +21,6 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.unix.DomainSocketReadMode; import io.netty.channel.unix.DomainSocketReadMode;
import io.netty.channel.unix.FileDescriptor; import io.netty.channel.unix.FileDescriptor;
import io.netty.testsuite.transport.TestsuitePermutation; import io.netty.testsuite.transport.TestsuitePermutation;

View File

@ -17,7 +17,6 @@ package io.netty.channel.kqueue;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.EventLoopGroup; import io.netty.channel.EventLoopGroup;
import io.netty.channel.MultithreadEventLoopGroup; import io.netty.channel.MultithreadEventLoopGroup;
import org.junit.AfterClass; import org.junit.AfterClass;

View File

@ -18,7 +18,6 @@ package io.netty.channel.kqueue;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelException; import io.netty.channel.ChannelException;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.EventLoopGroup; import io.netty.channel.EventLoopGroup;
import io.netty.channel.MultithreadEventLoopGroup; import io.netty.channel.MultithreadEventLoopGroup;
import org.junit.After; import org.junit.After;

View File

@ -19,7 +19,7 @@ package io.netty.handler.codec.sctp;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.sctp.SctpMessage; import io.netty.channel.sctp.SctpMessage;
import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.MessageToMessageDecoder;
@ -29,7 +29,7 @@ import java.util.Map;
/** /**
* {@link MessageToMessageDecoder} which will take care of handle fragmented {@link SctpMessage}s, so * {@link MessageToMessageDecoder} which will take care of handle fragmented {@link SctpMessage}s, so
* only <strong>complete</strong> {@link SctpMessage}s will be forwarded to the next * only <strong>complete</strong> {@link SctpMessage}s will be forwarded to the next
* {@link ChannelInboundHandler}. * {@link ChannelHandler}.
*/ */
public class SctpMessageCompletionHandler extends MessageToMessageDecoder<SctpMessage> { public class SctpMessageCompletionHandler extends MessageToMessageDecoder<SctpMessage> {
private final Map<Integer, ByteBuf> fragments = new HashMap<>(); private final Map<Integer, ByteBuf> fragments = new HashMap<>();

View File

@ -23,7 +23,6 @@ import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
@ -210,7 +209,7 @@ public class ServerBootstrap extends AbstractBootstrap<ServerBootstrap, ServerCh
return this; return this;
} }
private static class ServerBootstrapAcceptor implements ChannelInboundHandler { private static class ServerBootstrapAcceptor implements ChannelHandler {
private final ChannelHandler childHandler; private final ChannelHandler childHandler;
private final Entry<ChannelOption<?>, Object>[] childOptions; private final Entry<ChannelOption<?>, Object>[] childOptions;

View File

@ -272,7 +272,7 @@ public interface Channel extends AttributeMap, ChannelOutboundInvoker, Comparabl
void deregister(ChannelPromise promise); void deregister(ChannelPromise promise);
/** /**
* Schedules a read operation that fills the inbound buffer of the first {@link ChannelInboundHandler} in the * Schedules a read operation that fills the inbound buffer of the first {@link ChannelHandler} in the
* {@link ChannelPipeline}. If there's already a pending read operation, this method does nothing. * {@link ChannelPipeline}. If there's already a pending read operation, this method does nothing.
*/ */
void beginRead(); void beginRead();

View File

@ -125,7 +125,7 @@ public interface ChannelConfig {
* {@link MaxMessagesRecvByteBufAllocator#maxMessagesPerRead()}. * {@link MaxMessagesRecvByteBufAllocator#maxMessagesPerRead()}.
* <p> * <p>
* Returns the maximum number of messages to read per read loop. * Returns the maximum number of messages to read per read loop.
* a {@link ChannelInboundHandler#channelRead(ChannelHandlerContext, Object) channelRead()} event. * a {@link ChannelHandler#channelRead(ChannelHandlerContext, Object) channelRead()} event.
* If this value is greater than 1, an event loop might attempt to read multiple times to procure multiple messages. * If this value is greater than 1, an event loop might attempt to read multiple times to procure multiple messages.
*/ */
@Deprecated @Deprecated

View File

@ -82,7 +82,7 @@ import java.nio.channels.Channels;
* as how many times it is added to pipelines, regardless if it is added to the * as how many times it is added to pipelines, regardless if it is added to the
* same pipeline multiple times or added to different pipelines multiple times: * same pipeline multiple times or added to different pipelines multiple times:
* <pre> * <pre>
* public class FactorialHandler implements {@link ChannelInboundHandler} { * public class FactorialHandler implements {@link ChannelHandler} {
* *
* private final {@link AttributeKey}&lt;{@link Integer}&gt; counter = {@link AttributeKey}.valueOf("counter"); * private final {@link AttributeKey}&lt;{@link Integer}&gt; counter = {@link AttributeKey}.valueOf("counter");
* *

View File

@ -20,8 +20,8 @@ public interface ChannelInboundInvoker {
/** /**
* A {@link Channel} was registered to its {@link EventLoop}. * A {@link Channel} was registered to its {@link EventLoop}.
* *
* This will result in having the {@link ChannelInboundHandler#channelRegistered(ChannelHandlerContext)} method * This will result in having the {@link ChannelHandler#channelRegistered(ChannelHandlerContext)} method
* called of the next {@link ChannelInboundHandler} contained in the {@link ChannelPipeline} of the * called of the next {@link ChannelHandler} contained in the {@link ChannelPipeline} of the
* {@link Channel}. * {@link Channel}.
*/ */
ChannelInboundInvoker fireChannelRegistered(); ChannelInboundInvoker fireChannelRegistered();
@ -29,8 +29,8 @@ public interface ChannelInboundInvoker {
/** /**
* A {@link Channel} was unregistered from its {@link EventLoop}. * A {@link Channel} was unregistered from its {@link EventLoop}.
* *
* This will result in having the {@link ChannelInboundHandler#channelUnregistered(ChannelHandlerContext)} method * This will result in having the {@link ChannelHandler#channelUnregistered(ChannelHandlerContext)} method
* called of the next {@link ChannelInboundHandler} contained in the {@link ChannelPipeline} of the * called of the next {@link ChannelHandler} contained in the {@link ChannelPipeline} of the
* {@link Channel}. * {@link Channel}.
*/ */
ChannelInboundInvoker fireChannelUnregistered(); ChannelInboundInvoker fireChannelUnregistered();
@ -38,8 +38,8 @@ public interface ChannelInboundInvoker {
/** /**
* A {@link Channel} is active now, which means it is connected. * A {@link Channel} is active now, which means it is connected.
* *
* This will result in having the {@link ChannelInboundHandler#channelActive(ChannelHandlerContext)} method * This will result in having the {@link ChannelHandler#channelActive(ChannelHandlerContext)} method
* called of the next {@link ChannelInboundHandler} contained in the {@link ChannelPipeline} of the * called of the next {@link ChannelHandler} contained in the {@link ChannelPipeline} of the
* {@link Channel}. * {@link Channel}.
*/ */
ChannelInboundInvoker fireChannelActive(); ChannelInboundInvoker fireChannelActive();
@ -47,8 +47,8 @@ public interface ChannelInboundInvoker {
/** /**
* A {@link Channel} is inactive now, which means it is closed. * A {@link Channel} is inactive now, which means it is closed.
* *
* This will result in having the {@link ChannelInboundHandler#channelInactive(ChannelHandlerContext)} method * This will result in having the {@link ChannelHandler#channelInactive(ChannelHandlerContext)} method
* called of the next {@link ChannelInboundHandler} contained in the {@link ChannelPipeline} of the * called of the next {@link ChannelHandler} contained in the {@link ChannelPipeline} of the
* {@link Channel}. * {@link Channel}.
*/ */
ChannelInboundInvoker fireChannelInactive(); ChannelInboundInvoker fireChannelInactive();
@ -56,8 +56,8 @@ public interface ChannelInboundInvoker {
/** /**
* A {@link Channel} received an {@link Throwable} in one of its inbound operations. * A {@link Channel} received an {@link Throwable} in one of its inbound operations.
* *
* This will result in having the {@link ChannelInboundHandler#exceptionCaught(ChannelHandlerContext, Throwable)} * This will result in having the {@link ChannelHandler#exceptionCaught(ChannelHandlerContext, Throwable)}
* method called of the next {@link ChannelInboundHandler} contained in the {@link ChannelPipeline} of the * method called of the next {@link ChannelHandler} contained in the {@link ChannelPipeline} of the
* {@link Channel}. * {@link Channel}.
*/ */
ChannelInboundInvoker fireExceptionCaught(Throwable cause); ChannelInboundInvoker fireExceptionCaught(Throwable cause);
@ -65,8 +65,8 @@ public interface ChannelInboundInvoker {
/** /**
* A {@link Channel} received an user defined event. * A {@link Channel} received an user defined event.
* *
* This will result in having the {@link ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object)} * This will result in having the {@link ChannelHandler#userEventTriggered(ChannelHandlerContext, Object)}
* method called of the next {@link ChannelInboundHandler} contained in the {@link ChannelPipeline} of the * method called of the next {@link ChannelHandler} contained in the {@link ChannelPipeline} of the
* {@link Channel}. * {@link Channel}.
*/ */
ChannelInboundInvoker fireUserEventTriggered(Object event); ChannelInboundInvoker fireUserEventTriggered(Object event);
@ -74,21 +74,21 @@ public interface ChannelInboundInvoker {
/** /**
* A {@link Channel} received a message. * A {@link Channel} received a message.
* *
* This will result in having the {@link ChannelInboundHandler#channelRead(ChannelHandlerContext, Object)} * This will result in having the {@link ChannelHandler#channelRead(ChannelHandlerContext, Object)}
* method called of the next {@link ChannelInboundHandler} contained in the {@link ChannelPipeline} of the * method called of the next {@link ChannelHandler} contained in the {@link ChannelPipeline} of the
* {@link Channel}. * {@link Channel}.
*/ */
ChannelInboundInvoker fireChannelRead(Object msg); ChannelInboundInvoker fireChannelRead(Object msg);
/** /**
* Triggers an {@link ChannelInboundHandler#channelReadComplete(ChannelHandlerContext)} * Triggers an {@link ChannelHandler#channelReadComplete(ChannelHandlerContext)}
* event to the next {@link ChannelInboundHandler} in the {@link ChannelPipeline}. * event to the next {@link ChannelHandler} in the {@link ChannelPipeline}.
*/ */
ChannelInboundInvoker fireChannelReadComplete(); ChannelInboundInvoker fireChannelReadComplete();
/** /**
* Triggers an {@link ChannelInboundHandler#channelWritabilityChanged(ChannelHandlerContext)} * Triggers an {@link ChannelHandler#channelWritabilityChanged(ChannelHandlerContext)}
* event to the next {@link ChannelInboundHandler} in the {@link ChannelPipeline}. * event to the next {@link ChannelHandler} in the {@link ChannelPipeline}.
*/ */
ChannelInboundInvoker fireChannelWritabilityChanged(); ChannelInboundInvoker fireChannelWritabilityChanged();
} }

View File

@ -22,7 +22,7 @@ import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory; import io.netty.util.internal.logging.InternalLoggerFactory;
/** /**
* A special {@link ChannelInboundHandler} which offers an easy way to initialize a {@link Channel} once it was * A special {@link ChannelHandler} which offers an easy way to initialize a {@link Channel} once it was
* registered to its {@link EventLoop}. * registered to its {@link EventLoop}.
* *
* Implementations are most often used in the context of {@link Bootstrap#handler(ChannelHandler)} , * Implementations are most often used in the context of {@link Bootstrap#handler(ChannelHandler)} ,
@ -47,7 +47,7 @@ import io.netty.util.internal.logging.InternalLoggerFactory;
* @param <C> A sub-type of {@link Channel} * @param <C> A sub-type of {@link Channel}
*/ */
@Sharable @Sharable
public abstract class ChannelInitializer<C extends Channel> implements ChannelInboundHandler { public abstract class ChannelInitializer<C extends Channel> implements ChannelHandler {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(ChannelInitializer.class); private static final InternalLogger logger = InternalLoggerFactory.getInstance(ChannelInitializer.class);

View File

@ -179,8 +179,8 @@ public interface ChannelOutboundInvoker {
* The given {@link ChannelPromise} will be notified. * The given {@link ChannelPromise} will be notified.
* <p> * <p>
* This will result in having the * This will result in having the
* {@link ChannelOutboundHandler#close(ChannelHandlerContext, ChannelPromise)} * {@link ChannelHandler#close(ChannelHandlerContext, ChannelPromise)}
* method called of the next {@link ChannelOutboundHandler} contained in the {@link ChannelPipeline} of the * method called of the next {@link ChannelHandler} contained in the {@link ChannelPipeline} of the
* {@link Channel}. * {@link Channel}.
*/ */
ChannelFuture close(ChannelPromise promise); ChannelFuture close(ChannelPromise promise);
@ -193,8 +193,8 @@ public interface ChannelOutboundInvoker {
* The given {@link ChannelPromise} will be notified. * The given {@link ChannelPromise} will be notified.
* <p> * <p>
* This will result in having the * This will result in having the
* {@link ChannelOutboundHandler#register(ChannelHandlerContext, ChannelPromise)} * {@link ChannelHandler#register(ChannelHandlerContext, ChannelPromise)}
* method called of the next {@link ChannelOutboundHandler} contained in the {@link ChannelPipeline} of the * method called of the next {@link ChannelHandler} contained in the {@link ChannelPipeline} of the
* {@link Channel}. * {@link Channel}.
*/ */
ChannelFuture register(ChannelPromise promise); ChannelFuture register(ChannelPromise promise);

View File

@ -103,7 +103,7 @@ public class CombinedChannelDuplexHandler<I extends ChannelHandler, O extends Ch
} }
/** /**
* Removes the {@link ChannelInboundHandler} that was combined in this {@link CombinedChannelDuplexHandler}. * Removes the inbound {@link ChannelHandler} that was combined in this {@link CombinedChannelDuplexHandler}.
*/ */
public final void removeInboundHandler() { public final void removeInboundHandler() {
checkAdded(); checkAdded();
@ -111,7 +111,7 @@ public class CombinedChannelDuplexHandler<I extends ChannelHandler, O extends Ch
} }
/** /**
* Removes the {@link ChannelOutboundHandler} that was combined in this {@link CombinedChannelDuplexHandler}. * Removes the outbound {@link ChannelHandler} that was combined in this {@link CombinedChannelDuplexHandler}.
*/ */
public final void removeOutboundHandler() { public final void removeOutboundHandler() {
checkAdded(); checkAdded();

View File

@ -54,7 +54,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
private static final FastThreadLocal<Map<Class<?>, String>> nameCaches = private static final FastThreadLocal<Map<Class<?>, String>> nameCaches =
new FastThreadLocal<Map<Class<?>, String>>() { new FastThreadLocal<Map<Class<?>, String>>() {
@Override @Override
protected Map<Class<?>, String> initialValue() throws Exception { protected Map<Class<?>, String> initialValue() {
return new WeakHashMap<>(); return new WeakHashMap<>();
} }
}; };
@ -1011,7 +1011,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
/** /**
* Called once a {@link Throwable} hit the end of the {@link ChannelPipeline} without been handled by the user * Called once a {@link Throwable} hit the end of the {@link ChannelPipeline} without been handled by the user
* in {@link ChannelInboundHandler#exceptionCaught(ChannelHandlerContext, Throwable)}. * in {@link ChannelHandler#exceptionCaught(ChannelHandlerContext, Throwable)}.
*/ */
protected void onUnhandledInboundException(Throwable cause) { protected void onUnhandledInboundException(Throwable cause) {
try { try {
@ -1025,14 +1025,14 @@ public class DefaultChannelPipeline implements ChannelPipeline {
} }
/** /**
* Called once the {@link ChannelInboundHandler#channelActive(ChannelHandlerContext)}event hit * Called once the {@link ChannelHandler#channelActive(ChannelHandlerContext)}event hit
* the end of the {@link ChannelPipeline}. * the end of the {@link ChannelPipeline}.
*/ */
protected void onUnhandledInboundChannelActive() { protected void onUnhandledInboundChannelActive() {
} }
/** /**
* Called once the {@link ChannelInboundHandler#channelInactive(ChannelHandlerContext)} event hit * Called once the {@link ChannelHandler#channelInactive(ChannelHandlerContext)} event hit
* the end of the {@link ChannelPipeline}. * the end of the {@link ChannelPipeline}.
*/ */
protected void onUnhandledInboundChannelInactive() { protected void onUnhandledInboundChannelInactive() {
@ -1040,7 +1040,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
/** /**
* Called once a message hit the end of the {@link ChannelPipeline} without been handled by the user * Called once a message hit the end of the {@link ChannelPipeline} without been handled by the user
* in {@link ChannelInboundHandler#channelRead(ChannelHandlerContext, Object)}. This method is responsible * in {@link ChannelHandler#channelRead(ChannelHandlerContext, Object)}. This method is responsible
* to call {@link ReferenceCountUtil#release(Object)} on the given msg at some point. * to call {@link ReferenceCountUtil#release(Object)} on the given msg at some point.
*/ */
protected void onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg) { protected void onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg) {
@ -1055,7 +1055,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
} }
/** /**
* Called once the {@link ChannelInboundHandler#channelReadComplete(ChannelHandlerContext)} event hit * Called once the {@link ChannelHandler#channelReadComplete(ChannelHandlerContext)} event hit
* the end of the {@link ChannelPipeline}. * the end of the {@link ChannelPipeline}.
*/ */
protected void onUnhandledInboundChannelReadComplete() { protected void onUnhandledInboundChannelReadComplete() {
@ -1063,7 +1063,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
/** /**
* Called once an user event hit the end of the {@link ChannelPipeline} without been handled by the user * Called once an user event hit the end of the {@link ChannelPipeline} without been handled by the user
* in {@link ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object)}. This method is responsible * in {@link ChannelHandler#userEventTriggered(ChannelHandlerContext, Object)}. This method is responsible
* to call {@link ReferenceCountUtil#release(Object)} on the given event at some point. * to call {@link ReferenceCountUtil#release(Object)} on the given event at some point.
*/ */
protected void onUnhandledInboundUserEventTriggered(Object evt) { protected void onUnhandledInboundUserEventTriggered(Object evt) {
@ -1073,7 +1073,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
} }
/** /**
* Called once the {@link ChannelInboundHandler#channelWritabilityChanged(ChannelHandlerContext)} event hit * Called once the {@link ChannelHandler#channelWritabilityChanged(ChannelHandlerContext)} event hit
* the end of the {@link ChannelPipeline}. * the end of the {@link ChannelPipeline}.
*/ */
protected void onUnhandledChannelWritabilityChanged() { protected void onUnhandledChannelWritabilityChanged() {
@ -1096,7 +1096,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
} }
// A special catch-all handler that handles both bytes and messages. // A special catch-all handler that handles both bytes and messages.
private static final class TailHandler implements ChannelInboundHandler { private static final class TailHandler implements ChannelHandler {
@Override @Override
public void channelRegistered(ChannelHandlerContext ctx) { } public void channelRegistered(ChannelHandlerContext ctx) { }

View File

@ -24,7 +24,7 @@ import java.util.Map.Entry;
public interface MaxBytesRecvByteBufAllocator extends RecvByteBufAllocator { public interface MaxBytesRecvByteBufAllocator extends RecvByteBufAllocator {
/** /**
* Returns the maximum number of bytes to read per read loop. * Returns the maximum number of bytes to read per read loop.
* a {@link ChannelInboundHandler#channelRead(ChannelHandlerContext, Object) channelRead()} event. * a {@link ChannelHandler#channelRead(ChannelHandlerContext, Object) channelRead()} event.
* If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes. * If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes.
*/ */
int maxBytesPerRead(); int maxBytesPerRead();
@ -37,7 +37,7 @@ public interface MaxBytesRecvByteBufAllocator extends RecvByteBufAllocator {
/** /**
* Returns the maximum number of bytes to read per individual read operation. * Returns the maximum number of bytes to read per individual read operation.
* a {@link ChannelInboundHandler#channelRead(ChannelHandlerContext, Object) channelRead()} event. * a {@link ChannelHandler#channelRead(ChannelHandlerContext, Object) channelRead()} event.
* If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes. * If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes.
*/ */
int maxBytesPerIndividualRead(); int maxBytesPerIndividualRead();

View File

@ -22,7 +22,7 @@ package io.netty.channel;
public interface MaxMessagesRecvByteBufAllocator extends RecvByteBufAllocator { public interface MaxMessagesRecvByteBufAllocator extends RecvByteBufAllocator {
/** /**
* Returns the maximum number of messages to read per read loop. * Returns the maximum number of messages to read per read loop.
* a {@link ChannelInboundHandler#channelRead(ChannelHandlerContext, Object) channelRead()} event. * a {@link ChannelHandler#channelRead(ChannelHandlerContext, Object) channelRead()} event.
* If this value is greater than 1, an event loop might attempt to read multiple times to procure multiple messages. * If this value is greater than 1, an event loop might attempt to read multiple times to procure multiple messages.
*/ */
int maxMessagesPerRead(); int maxMessagesPerRead();

View File

@ -19,7 +19,7 @@ import io.netty.util.ReferenceCountUtil;
import io.netty.util.internal.TypeParameterMatcher; import io.netty.util.internal.TypeParameterMatcher;
/** /**
* {@link ChannelInboundHandler} which allows to explicit only handle a specific type of messages. * {@link ChannelHandler} which allows to explicit only handle a specific type of messages.
* *
* For example here is an implementation which only handle {@link String} messages. * For example here is an implementation which only handle {@link String} messages.
* *
@ -39,7 +39,7 @@ import io.netty.util.internal.TypeParameterMatcher;
* {@link ReferenceCountUtil#release(Object)}. In this case you may need to use * {@link ReferenceCountUtil#release(Object)}. In this case you may need to use
* {@link ReferenceCountUtil#retain(Object)} if you pass the object to the next handler in the {@link ChannelPipeline}. * {@link ReferenceCountUtil#retain(Object)} if you pass the object to the next handler in the {@link ChannelPipeline}.
*/ */
public abstract class SimpleChannelInboundHandler<I> implements ChannelInboundHandler { public abstract class SimpleChannelInboundHandler<I> implements ChannelHandler {
private final TypeParameterMatcher matcher; private final TypeParameterMatcher matcher;
private final boolean autoRelease; private final boolean autoRelease;
@ -83,7 +83,7 @@ public abstract class SimpleChannelInboundHandler<I> implements ChannelInboundHa
/** /**
* Returns {@code true} if the given message should be handled. If {@code false} it will be passed to the next * Returns {@code true} if the given message should be handled. If {@code false} it will be passed to the next
* {@link ChannelInboundHandler} in the {@link ChannelPipeline}. * {@link ChannelHandler} in the {@link ChannelPipeline}.
*/ */
public boolean acceptInboundMessage(Object msg) throws Exception { public boolean acceptInboundMessage(Object msg) throws Exception {
return matcher.match(msg); return matcher.match(msg);

View File

@ -19,7 +19,7 @@ import io.netty.util.ReferenceCountUtil;
import io.netty.util.internal.TypeParameterMatcher; import io.netty.util.internal.TypeParameterMatcher;
/** /**
* {@link ChannelInboundHandler} which allows to conveniently only handle a specific type of user events. * {@link ChannelHandler} which allows to conveniently only handle a specific type of user events.
* *
* For example, here is an implementation which only handle {@link String} user events. * For example, here is an implementation which only handle {@link String} user events.
* *
@ -39,7 +39,7 @@ import io.netty.util.internal.TypeParameterMatcher;
* {@link ReferenceCountUtil#release(Object)}. In this case you may need to use * {@link ReferenceCountUtil#release(Object)}. In this case you may need to use
* {@link ReferenceCountUtil#retain(Object)} if you pass the object to the next handler in the {@link ChannelPipeline}. * {@link ReferenceCountUtil#retain(Object)} if you pass the object to the next handler in the {@link ChannelPipeline}.
*/ */
public abstract class SimpleUserEventChannelHandler<I> implements ChannelInboundHandler { public abstract class SimpleUserEventChannelHandler<I> implements ChannelHandler {
private final TypeParameterMatcher matcher; private final TypeParameterMatcher matcher;
private final boolean autoRelease; private final boolean autoRelease;
@ -83,7 +83,7 @@ public abstract class SimpleUserEventChannelHandler<I> implements ChannelInbound
/** /**
* Returns {@code true} if the given user event should be handled. If {@code false} it will be passed to the next * Returns {@code true} if the given user event should be handled. If {@code false} it will be passed to the next
* {@link ChannelInboundHandler} in the {@link ChannelPipeline}. * {@link ChannelHandler} in the {@link ChannelPipeline}.
*/ */
protected boolean acceptEvent(Object evt) throws Exception { protected boolean acceptEvent(Object evt) throws Exception {
return matcher.match(evt); return matcher.match(evt);

View File

@ -21,8 +21,8 @@ import io.netty.buffer.ByteBufHolder;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelId; import io.netty.channel.ChannelId;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.EventLoop; import io.netty.channel.EventLoop;
import io.netty.channel.ServerChannel; import io.netty.channel.ServerChannel;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
@ -82,7 +82,7 @@ import java.util.Set;
* <strong>allChannels.close().awaitUninterruptibly();</strong> * <strong>allChannels.close().awaitUninterruptibly();</strong>
* } * }
* *
* public class MyHandler implements {@link ChannelInboundHandler} { * public class MyHandler implements {@link ChannelHandler} {
* {@code @Override} * {@code @Override}
* public void channelActive({@link ChannelHandlerContext} ctx) { * public void channelActive({@link ChannelHandlerContext} ctx) {
* // closed on shutdown. * // closed on shutdown.

View File

@ -16,11 +16,11 @@
package io.netty.channel.socket; package io.netty.channel.socket;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler; import io.netty.channel.ChannelHandler;
/** /**
* Special event which will be fired and passed to the * Special event which will be fired and passed to the
* {@link ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object)} methods once the input of * {@link ChannelHandler#userEventTriggered(ChannelHandlerContext, Object)} methods once the input of
* a {@link SocketChannel} was shutdown and the {@link SocketChannelConfig#isAllowHalfClosure()} method returns * a {@link SocketChannel} was shutdown and the {@link SocketChannelConfig#isAllowHalfClosure()} method returns
* {@code true}. * {@code true}.
*/ */

View File

@ -16,12 +16,12 @@
package io.netty.channel.socket; package io.netty.channel.socket;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler; import io.netty.channel.ChannelHandler;
import io.netty.util.internal.UnstableApi; import io.netty.util.internal.UnstableApi;
/** /**
* Special event which will be fired and passed to the * Special event which will be fired and passed to the
* {@link ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object)} methods once the output of * {@link ChannelHandler#userEventTriggered(ChannelHandlerContext, Object)} methods once the output of
* a {@link SocketChannel} was shutdown. * a {@link SocketChannel} was shutdown.
*/ */
@UnstableApi @UnstableApi

View File

@ -18,7 +18,7 @@ package io.netty.channel.socket;
import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import io.netty.channel.MessageSizeEstimator; import io.netty.channel.MessageSizeEstimator;
import io.netty.channel.RecvByteBufAllocator; import io.netty.channel.RecvByteBufAllocator;
@ -152,7 +152,7 @@ public interface SocketChannelConfig extends ChannelConfig {
* Sets whether the channel should not close itself when its remote peer shuts down output to * Sets whether the channel should not close itself when its remote peer shuts down output to
* make the connection half-closed. If {@code true} the connection is not closed when the * make the connection half-closed. If {@code true} the connection is not closed when the
* remote peer shuts down output. Instead, * remote peer shuts down output. Instead,
* {@link ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object)} * {@link ChannelHandler#userEventTriggered(ChannelHandlerContext, Object)}
* is invoked with a {@link ChannelInputShutdownEvent} object. If {@code false}, the connection * is invoked with a {@link ChannelInputShutdownEvent} object. If {@code false}, the connection
* is closed automatically. * is closed automatically.
*/ */

View File

@ -17,7 +17,6 @@ package io.netty.bootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.MultithreadEventLoopGroup; import io.netty.channel.MultithreadEventLoopGroup;
@ -47,7 +46,7 @@ public class ServerBootstrapTest {
sb.channel(LocalServerChannel.class) sb.channel(LocalServerChannel.class)
.group(group) .group(group)
.childHandler(new ChannelHandler() { }) .childHandler(new ChannelHandler() { })
.handler(new ChannelHandlerAdapter() { .handler(new ChannelHandler() {
@Override @Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception { public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
try { try {

View File

@ -251,7 +251,7 @@ public class ChannelInitializerTest {
} }
} }
private static final class InspectableHandler extends ChannelDuplexHandler { private static final class InspectableHandler implements ChannelHandler {
final AtomicInteger channelRegisteredCount = new AtomicInteger(0); final AtomicInteger channelRegisteredCount = new AtomicInteger(0);
@Override @Override

View File

@ -191,7 +191,7 @@ public class CombinedChannelDuplexHandlerTest {
CombinedChannelDuplexHandler<ChannelHandler, ChannelHandler> handler = CombinedChannelDuplexHandler<ChannelHandler, ChannelHandler> handler =
new CombinedChannelDuplexHandler<>( new CombinedChannelDuplexHandler<>(
inboundHandler, new ChannelOutboundHandler() { }); inboundHandler, new ChannelHandler() { });
EmbeddedChannel channel = new EmbeddedChannel(handler); EmbeddedChannel channel = new EmbeddedChannel(handler);
channel.pipeline().fireChannelWritabilityChanged(); channel.pipeline().fireChannelWritabilityChanged();
@ -359,9 +359,9 @@ public class CombinedChannelDuplexHandlerTest {
} }
}; };
EmbeddedChannel ch = new EmbeddedChannel(outboundHandler, EmbeddedChannel ch = new EmbeddedChannel(outboundHandler,
new CombinedChannelDuplexHandler<ChannelInboundHandler, ChannelOutboundHandler>( new CombinedChannelDuplexHandler<ChannelHandler, ChannelHandler>(
new ChannelInboundHandler() { new ChannelHandler() {
}, new ChannelOutboundHandler() { })); }, new ChannelHandler() { }));
ChannelPipeline pipeline = ch.pipeline(); ChannelPipeline pipeline = ch.pipeline();
ChannelPromise promise = ch.newPromise(); ChannelPromise promise = ch.newPromise();
@ -392,7 +392,7 @@ public class CombinedChannelDuplexHandlerTest {
@Test(expected = IllegalStateException.class) @Test(expected = IllegalStateException.class)
public void testNotSharable() { public void testNotSharable() {
new CombinedChannelDuplexHandler<ChannelInboundHandler, ChannelOutboundHandler>() { new CombinedChannelDuplexHandler<ChannelHandler, ChannelHandler>() {
@Override @Override
public boolean isSharable() { public boolean isSharable() {
return true; return true;

View File

@ -146,7 +146,7 @@ public class DefaultChannelPipelineTest {
assertTrue(handler.called); assertTrue(handler.called);
} }
private static final class StringInboundHandler implements ChannelInboundHandler { private static final class StringInboundHandler implements ChannelHandler {
boolean called; boolean called;
@Override @Override
@ -946,7 +946,7 @@ public class DefaultChannelPipelineTest {
EmbeddedChannel channel = new EmbeddedChannel(true); EmbeddedChannel channel = new EmbeddedChannel(true);
ChannelPipeline pipeline = channel.pipeline(); ChannelPipeline pipeline = channel.pipeline();
final class SkipHandler implements ChannelInboundHandler, ChannelOutboundHandler { final class SkipHandler implements ChannelHandler {
private int state = 2; private int state = 2;
private Error errorRef; private Error errorRef;
@ -1100,7 +1100,7 @@ public class DefaultChannelPipelineTest {
} }
} }
final class OutboundCalledHandler implements ChannelOutboundHandler { final class OutboundCalledHandler implements ChannelHandler {
private static final int MASK_BIND = 1; private static final int MASK_BIND = 1;
private static final int MASK_CONNECT = 1 << 1; private static final int MASK_CONNECT = 1 << 1;
private static final int MASK_DISCONNECT = 1 << 2; private static final int MASK_DISCONNECT = 1 << 2;
@ -1197,7 +1197,7 @@ public class DefaultChannelPipelineTest {
} }
} }
final class InboundCalledHandler implements ChannelInboundHandler { final class InboundCalledHandler implements ChannelHandler {
private static final int MASK_CHANNEL_REGISTER = 1; private static final int MASK_CHANNEL_REGISTER = 1;
private static final int MASK_CHANNEL_UNREGISTER = 1 << 1; private static final int MASK_CHANNEL_UNREGISTER = 1 << 1;
@ -1463,7 +1463,7 @@ public class DefaultChannelPipelineTest {
} }
} }
private static final class CheckExceptionHandler implements ChannelInboundHandler { private static final class CheckExceptionHandler implements ChannelHandler {
private final Throwable expected; private final Throwable expected;
private final Promise<Void> promise; private final Promise<Void> promise;
@ -1492,7 +1492,7 @@ public class DefaultChannelPipelineTest {
fail("handler was not one of the expected handlers"); fail("handler was not one of the expected handlers");
} }
private static final class CheckOrderHandler implements ChannelInboundHandler { private static final class CheckOrderHandler implements ChannelHandler {
private final Queue<CheckOrderHandler> addedQueue; private final Queue<CheckOrderHandler> addedQueue;
private final Queue<CheckOrderHandler> removedQueue; private final Queue<CheckOrderHandler> removedQueue;
private final AtomicReference<Throwable> error = new AtomicReference<>(); private final AtomicReference<Throwable> error = new AtomicReference<>();

View File

@ -193,7 +193,7 @@ public class PendingWriteQueueTest {
private static EmbeddedChannel newChannel() { private static EmbeddedChannel newChannel() {
// Add a handler so we can access a ChannelHandlerContext via the ChannelPipeline. // Add a handler so we can access a ChannelHandlerContext via the ChannelPipeline.
return new EmbeddedChannel(new ChannelHandlerAdapter() { }); return new EmbeddedChannel(new ChannelHandler() { });
} }
@Test @Test

View File

@ -85,7 +85,7 @@ public class SimpleUserEventChannelHandlerTest {
} }
} }
static final class AllEventCatcher implements ChannelInboundHandler { static final class AllEventCatcher implements ChannelHandler {
public List<Object> caughtEvents; public List<Object> caughtEvents;

View File

@ -40,7 +40,6 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelId; import io.netty.channel.ChannelId;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
@ -148,7 +147,7 @@ public class EmbeddedChannelTest {
public void testHandlerAddedExecutedInEventLoop() throws Throwable { public void testHandlerAddedExecutedInEventLoop() throws Throwable {
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<Throwable> error = new AtomicReference<>(); final AtomicReference<Throwable> error = new AtomicReference<>();
final ChannelHandler handler = new ChannelHandlerAdapter() { final ChannelHandler handler = new ChannelHandler() {
@Override @Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception { public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
try { try {

View File

@ -19,9 +19,9 @@ import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandler;
import io.netty.channel.MultithreadEventLoopGroup; import io.netty.channel.MultithreadEventLoopGroup;
import io.netty.util.ReferenceCountUtil; import io.netty.util.ReferenceCountUtil;
import org.junit.Test; import org.junit.Test;
@ -90,7 +90,7 @@ public class LocalTransportThreadModelTest2 {
} }
@Sharable @Sharable
static class LocalHandler implements ChannelInboundHandler { static class LocalHandler implements ChannelHandler {
private final String name; private final String name;
public volatile ChannelFuture lastWriteFuture; public volatile ChannelFuture lastWriteFuture;