diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java index a8ecee555f..3cbfe73550 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java @@ -22,6 +22,7 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelMetadata; import io.netty.channel.ChannelOutboundBuffer; import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPromise; @@ -51,7 +52,7 @@ import static io.netty.channel.unix.FileDescriptor.pipe; import static io.netty.util.internal.ObjectUtil.checkNotNull; public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel implements DuplexChannel { - + private static final ChannelMetadata METADATA = new ChannelMetadata(false, 16); private static final String EXPECTED_TYPES = " (expected: " + StringUtil.simpleClassName(ByteBuf.class) + ", " + StringUtil.simpleClassName(DefaultFileRegion.class) + ')'; @@ -130,6 +131,11 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im return new EpollStreamUnsafe(); } + @Override + public ChannelMetadata metadata() { + return METADATA; + } + /** * Splice from this {@link AbstractEpollStreamChannel} to another {@link AbstractEpollStreamChannel}. * The {@code len} is the number of bytes to splice. If using {@link Integer#MAX_VALUE} it will diff --git a/transport-udt/src/main/java/io/netty/channel/udt/nio/NioUdtByteConnectorChannel.java b/transport-udt/src/main/java/io/netty/channel/udt/nio/NioUdtByteConnectorChannel.java index 62dbb9ffd7..cc646934df 100644 --- a/transport-udt/src/main/java/io/netty/channel/udt/nio/NioUdtByteConnectorChannel.java +++ b/transport-udt/src/main/java/io/netty/channel/udt/nio/NioUdtByteConnectorChannel.java @@ -44,8 +44,6 @@ public class NioUdtByteConnectorChannel extends AbstractNioByteChannel implement private static final InternalLogger logger = InternalLoggerFactory.getInstance(NioUdtByteConnectorChannel.class); - private static final ChannelMetadata METADATA = new ChannelMetadata(false, 16); - private final UdtChannelConfig config; public NioUdtByteConnectorChannel() { @@ -175,11 +173,6 @@ public class NioUdtByteConnectorChannel extends AbstractNioByteChannel implement return javaChannel().socket().getLocalSocketAddress(); } - @Override - public ChannelMetadata metadata() { - return METADATA; - } - @Override protected SocketAddress remoteAddress0() { return javaChannel().socket().getRemoteSocketAddress(); diff --git a/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java b/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java index cc59b84d8a..7d16ed4ae6 100644 --- a/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java +++ b/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java @@ -20,6 +20,7 @@ import io.netty.buffer.ByteBufAllocator; import io.netty.channel.Channel; import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelMetadata; import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOutboundBuffer; import io.netty.channel.ChannelPipeline; @@ -36,7 +37,7 @@ import java.nio.channels.SelectionKey; * {@link AbstractNioChannel} base class for {@link Channel}s that operate on bytes. */ public abstract class AbstractNioByteChannel extends AbstractNioChannel { - + private static final ChannelMetadata METADATA = new ChannelMetadata(false, 16); private static final String EXPECTED_TYPES = " (expected: " + StringUtil.simpleClassName(ByteBuf.class) + ", " + StringUtil.simpleClassName(FileRegion.class) + ')'; @@ -63,6 +64,11 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel { return new NioByteUnsafe(); } + @Override + public ChannelMetadata metadata() { + return METADATA; + } + protected class NioByteUnsafe extends AbstractNioUnsafe { private void closeOnRead(ChannelPipeline pipeline) { diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java b/transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java index 32aa311126..891dd476fa 100644 --- a/transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java +++ b/transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java @@ -48,7 +48,6 @@ import java.util.concurrent.Executor; */ public class NioSocketChannel extends AbstractNioByteChannel implements io.netty.channel.socket.SocketChannel { private static final InternalLogger logger = InternalLoggerFactory.getInstance(NioSocketChannel.class); - private static final ChannelMetadata METADATA = new ChannelMetadata(false, 16); private static final SelectorProvider DEFAULT_SELECTOR_PROVIDER = SelectorProvider.provider(); private static SocketChannel newSocket(SelectorProvider provider) { @@ -104,11 +103,6 @@ public class NioSocketChannel extends AbstractNioByteChannel implements io.netty return (ServerSocketChannel) super.parent(); } - @Override - public ChannelMetadata metadata() { - return METADATA; - } - @Override public SocketChannelConfig config() { return config;