From 57e504a7e66d91b030148b3a63302116f042b5ae Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Sun, 20 Jan 2013 08:10:15 +0100 Subject: [PATCH] Add javadocs to the *ChannelConfig interfaces to make clear which ChannelOptions implementations are expect to support --- .../netty/channel/rxtx/RxtxChannelConfig.java | 24 +++++++++ .../netty/channel/sctp/SctpChannelConfig.java | 9 ++-- .../channel/sctp/SctpServerChannelConfig.java | 9 ++-- .../netty/channel/udt/UdtChannelConfig.java | 51 ++++++++++--------- .../java/io/netty/channel/ChannelConfig.java | 8 ++- .../channel/socket/DatagramChannelConfig.java | 31 +++++++---- .../channel/socket/SocketChannelConfig.java | 16 +++--- .../socket/aio/AioSocketChannelConfig.java | 13 +++++ 8 files changed, 109 insertions(+), 52 deletions(-) diff --git a/transport-rxtx/src/main/java/io/netty/channel/rxtx/RxtxChannelConfig.java b/transport-rxtx/src/main/java/io/netty/channel/rxtx/RxtxChannelConfig.java index f9989eca79..4effbf09aa 100644 --- a/transport-rxtx/src/main/java/io/netty/channel/rxtx/RxtxChannelConfig.java +++ b/transport-rxtx/src/main/java/io/netty/channel/rxtx/RxtxChannelConfig.java @@ -17,6 +17,7 @@ package io.netty.channel.rxtx; import gnu.io.SerialPort; import io.netty.channel.ChannelOption; +import io.netty.channel.ChannelConfig; import io.netty.channel.DefaultChannelConfig; import java.util.Map; @@ -25,6 +26,29 @@ import static io.netty.channel.rxtx.RxtxChannelOption.*; /** * A configuration class for RXTX device connections. + * + *

Available options

+ * + * In addition to the options provided by {@link ChannelConfig}, + * {@link RxtxChannelConfig} allows the following options in the option map: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameAssociated setter method
{@link io.netty.channel.rxtx.RxtxChannelOption#BAUD_RATE}{@link #setBaudrate(int)}
{@link io.netty.channel.rxtx.RxtxChannelOption#DTR}{@link #setDtr(boolean)}
{@link io.netty.channel.rxtx.RxtxChannelOption#RTS}{@link #setRts(boolean)}
{@link io.netty.channel.rxtx.RxtxChannelOption#STOP_BITS}{@link #setStopbits(Stopbits)}
{@link io.netty.channel.rxtx.RxtxChannelOption#DATA_BITS}{@link #setDatabits(Databits)}
{@link io.netty.channel.rxtx.RxtxChannelOption#PARITY_BIT}{@link #setParitybit(Paritybit)}
*/ public class RxtxChannelConfig extends DefaultChannelConfig { diff --git a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpChannelConfig.java b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpChannelConfig.java index 0db0e8e606..d22cded6e2 100644 --- a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpChannelConfig.java +++ b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpChannelConfig.java @@ -32,14 +32,13 @@ import static com.sun.nio.sctp.SctpStandardSocketOptions.*; * * NameAssociated setter method * - * {@code "sctpNoDelay"}{@link #setSctpNoDelay(boolean)}} + * {@link SctpChannelOption#SCTP_NODELAY}{@link #setSctpNoDelay(boolean)}} * - * {@code "receiveBufferSize"}{@link #setReceiveBufferSize(int)} + * {@link SctpChannelOption#SO_RCVBUF}{@link #setReceiveBufferSize(int)} * - * {@code "sendBufferSize"}{@link #setSendBufferSize(int)} + * {@link SctpChannelOption#SO_SNDBUF}{@link #setSendBufferSize(int)} * - * {@code "sctpInitMaxStreams"} - * {@link #setInitMaxStreams(InitMaxStreams)} + * {@link SctpChannelOption#SCTP_INIT_MAXSTREAMS}{@link #setInitMaxStreams(InitMaxStreams)} * * */ diff --git a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpServerChannelConfig.java b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpServerChannelConfig.java index 1c8f67a4f9..fcf58b6019 100644 --- a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpServerChannelConfig.java +++ b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpServerChannelConfig.java @@ -33,14 +33,13 @@ import static com.sun.nio.sctp.SctpStandardSocketOptions.*; * * NameAssociated setter method * - * {@code "backlog"}{@link #setBacklog(int)} + * {@link SctpChannelOption#SO_BACKLOG}{@link #setBacklog(int)} * - * * {@code "receiveBufferSize"}{@link #setReceiveBufferSize(int)} + * {@link SctpChannelOption#SO_RCVBUF}{@link #setReceiveBufferSize(int)} * - * {@code "sendBufferSize"}{@link #setSendBufferSize(int)} + * {@link SctpChannelOption#SO_SNDBUF}{@link #setSendBufferSize(int)} * - * {@code "sctpInitMaxStreams"} - * {@link #setInitMaxStreams(InitMaxStreams)} (int)}} + * {@link SctpChannelOption#SCTP_INIT_MAXSTREAMS}{@link #setInitMaxStreams(InitMaxStreams)} * * */ diff --git a/transport-udt/src/main/java/io/netty/channel/udt/UdtChannelConfig.java b/transport-udt/src/main/java/io/netty/channel/udt/UdtChannelConfig.java index 8b28bd60e2..71264f8293 100644 --- a/transport-udt/src/main/java/io/netty/channel/udt/UdtChannelConfig.java +++ b/transport-udt/src/main/java/io/netty/channel/udt/UdtChannelConfig.java @@ -34,31 +34,34 @@ import com.barchart.udt.nio.KindUDT; * * Name * Associated setter method - * - * - * {@code "reuseAddress"} - * {@link #setReuseAddress(boolean)} - * - * - * {@code "soLinger"} - * {@link #setSoLinger(int)} - * - * - * {@code "receiveBufferSize"} - * {@link #setReceiveBufferSize(int)} - * - * - * {@code "sendBufferSize"} - * {@link #setSendBufferSize(int)} - * - * - * {@code "protocolReceiveBuferSize"} + * + * {@link io.netty.channel.ChannelOption#SO_REUSEADDR}{@link #setReuseAddress(boolean)} + * + * {@link io.netty.channel.ChannelOption#SO_RCVBUF}{@link #setReceiveBufferSize(int)} + * + * {@link io.netty.channel.ChannelOption#SO_SNDBUF}{@link #setSendBufferSize(int)} + * + * {@link io.netty.channel.ChannelOption#SO_REUSEADDR}{@link #setReuseAddress(boolean)} + * + * {@link io.netty.channel.ChannelOption#SO_LINGER}{@link #setSoLinger(int)} + * + * {@link io.netty.channel.ChannelOption#SO_RCVBUF}{@link #setReceiveBufferSize(int)} + * + * {@link io.netty.channel.ChannelOption#SO_SNDBUF}{@link #setSendBufferSize(int)} + * + * {@link io.netty.channel.udt.UdtChannelOption#PROTOCOL_RECEIVE_BUFFER_SIZE} * {@link #setProtocolReceiveBufferSize(int)} - * - * - * {@code "systemReceiveBufferSize"} - * {@link #setProtocolReceiveBufferSize(int)} - * + * + * {@link io.netty.channel.udt.UdtChannelOption#PROTOCOL_SEND_BUFFER_SIZE} + * {@link #setProtocolSendBufferSize(int)} + * + * {@link io.netty.channel.udt.UdtChannelOption#SYSTEM_RECEIVE_BUFFER_SIZE} + * {@link #setSystemReceiveBufferSize(int)} + * + * {@link io.netty.channel.udt.UdtChannelOption#SYSTEM_SEND_BUFFER_SIZE} + * {@link #setSystemSendBufferSize(int)} + + * * *

* Note that {@link TypeUDT#DATAGRAM} message oriented channels treat diff --git a/transport/src/main/java/io/netty/channel/ChannelConfig.java b/transport/src/main/java/io/netty/channel/ChannelConfig.java index a52c8de73e..d2b9442955 100644 --- a/transport/src/main/java/io/netty/channel/ChannelConfig.java +++ b/transport/src/main/java/io/netty/channel/ChannelConfig.java @@ -46,7 +46,13 @@ import java.util.Map; * * NameAssociated setter method * - * {@code "connectTimeoutMillis"}{@link #setConnectTimeoutMillis(int)} + * {@link io.netty.channel.ChannelOption#CONNECT_TIMEOUT_MILLIS}{@link #setConnectTimeoutMillis(int)} + * + * {@link io.netty.channel.ChannelOption#WRITE_SPIN_COUNT}{@link #setWriteSpinCount(int)} + * + * {@link io.netty.channel.ChannelOption#ALLOCATOR}{@link #setAllocator(ByteBufAllocator)} + * + * {@link io.netty.channel.ChannelOption#AUTO_READ}{@link #setAutoRead(boolean)} * * *

diff --git a/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java b/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java index 48dee5b94f..0a2517244c 100644 --- a/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java +++ b/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java @@ -17,7 +17,6 @@ package io.netty.channel.socket; import io.netty.buffer.ByteBufAllocator; import io.netty.channel.ChannelConfig; - import java.net.InetAddress; import java.net.NetworkInterface; import java.net.StandardSocketOptions; @@ -34,23 +33,27 @@ import java.net.StandardSocketOptions; * * NameAssociated setter method * - * {@code "broadcast"}{@link #setBroadcast(boolean)} + * {@link io.netty.channel.ChannelOption#SO_BROADCAST}{@link #setBroadcast(boolean)} * - * {@code "interface"}{@link #setInterface(InetAddress)} + * {@link io.netty.channel.ChannelOption#IP_MULTICAST_ADDR}{@link #setInterface(InetAddress)} * - * {@code "loopbackModeDisabled"}{@link #setLoopbackModeDisabled(boolean)} + * {@link io.netty.channel.ChannelOption#IP_MULTICAST_LOOP_DISABLED} + * {@link #setLoopbackModeDisabled(boolean)} * - * {@code "networkInterface"}{@link #setNetworkInterface(NetworkInterface)} + * {@link io.netty.channel.ChannelOption#IP_MULTICAST_IF} + * {@link #setNetworkInterface(NetworkInterface)} * - * {@code "reuseAddress"}{@link #setReuseAddress(boolean)} + * {@link io.netty.channel.ChannelOption#SO_REUSEADDR}{@link #setReuseAddress(boolean)} * - * {@code "receiveBufferSize"}{@link #setReceiveBufferSize(int)} + * {@link io.netty.channel.ChannelOption#SO_RCVBUF}{@link #setReceiveBufferSize(int)} * - * {@code "sendBufferSize"}{@link #setSendBufferSize(int)} + * {@link io.netty.channel.ChannelOption#SO_SNDBUF}{@link #setSendBufferSize(int)} * - * {@code "timeToLive"}{@link #setTimeToLive(int)} + * {@link io.netty.channel.ChannelOption#IP_MULTICAST_TTL}{@link #setTimeToLive(int)} * - * {@code "trafficClass"}{@link #setTrafficClass(int)} + * {@link io.netty.channel.ChannelOption#IP_TOS}{@link #setTrafficClass(int)} + * + * {@link io.netty.channel.ChannelOption#UDP_RECEIVE_PACKET_SIZE}{@link #setReceivePacketSize(int)} * * */ @@ -76,8 +79,16 @@ public interface DatagramChannelConfig extends ChannelConfig { */ DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize); + /** + * Gets the size of the {@link DatagramPacket#data()} which will be used to store the received data. + * This should match the maximal packet size that you expect to receive. + */ int getReceivePacketSize(); + /** + * Sets the size of the {@link DatagramPacket#data()} which will be used to store the received data. + * This should match the maximal packet size that you expect to receive. + */ DatagramChannelConfig setReceivePacketSize(int receivePacketSize); /** diff --git a/transport/src/main/java/io/netty/channel/socket/SocketChannelConfig.java b/transport/src/main/java/io/netty/channel/socket/SocketChannelConfig.java index 5a00d3c11d..79f4bdc436 100644 --- a/transport/src/main/java/io/netty/channel/socket/SocketChannelConfig.java +++ b/transport/src/main/java/io/netty/channel/socket/SocketChannelConfig.java @@ -35,19 +35,21 @@ import java.net.StandardSocketOptions; * * NameAssociated setter method * - * {@code "keepAlive"}{@link #setKeepAlive(boolean)} + * {@link io.netty.channel.ChannelOption#SO_KEEPALIVE}{@link #setKeepAlive(boolean)} * - * {@code "reuseAddress"}{@link #setReuseAddress(boolean)} + * {@link io.netty.channel.ChannelOption#SO_REUSEADDR}{@link #setReuseAddress(boolean)} * - * {@code "soLinger"}{@link #setSoLinger(int)} + * {@link io.netty.channel.ChannelOption#SO_LINGER}{@link #setSoLinger(int)} * - * {@code "tcpNoDelay"}{@link #setTcpNoDelay(boolean)} + * {@link io.netty.channel.ChannelOption#TCP_NODELAY}{@link #setTcpNoDelay(boolean)} * - * {@code "receiveBufferSize"}{@link #setReceiveBufferSize(int)} + * {@link io.netty.channel.ChannelOption#SO_RCVBUF}{@link #setReceiveBufferSize(int)} * - * {@code "sendBufferSize"}{@link #setSendBufferSize(int)} + * {@link io.netty.channel.ChannelOption#SO_SNDBUF}{@link #setSendBufferSize(int)} * - * {@code "trafficClass"}{@link #setTrafficClass(int)} + * {@link io.netty.channel.ChannelOption#IP_TOS}{@link #setTrafficClass(int)} + * + * {@link io.netty.channel.ChannelOption#ALLOW_HALF_CLOSURE}{@link #setAllowHalfClosure(boolean)} * * */ diff --git a/transport/src/main/java/io/netty/channel/socket/aio/AioSocketChannelConfig.java b/transport/src/main/java/io/netty/channel/socket/aio/AioSocketChannelConfig.java index 3e871faa5b..cb3d6c42d5 100644 --- a/transport/src/main/java/io/netty/channel/socket/aio/AioSocketChannelConfig.java +++ b/transport/src/main/java/io/netty/channel/socket/aio/AioSocketChannelConfig.java @@ -24,6 +24,19 @@ import java.nio.channels.InterruptedByTimeoutException; /** * Special {@link SocketChannelConfig} which is used for the {@link AioSocketChannel} to expose extra configuration * possiblilites. + * + * In addition to the options provided by {@link SocketChannelConfig}, + * {@link AioSocketChannelConfig} allows the following options in the option map: + * + * + * + * + * + * + * + * + * + *
NameAssociated setter method
{@link io.netty.channel.ChannelOption#AIO_READ_TIMEOUT}{@link #setReadTimeout(long)}
{@link io.netty.channel.ChannelOption#AIO_WRITE_TIMEOUT}{@link #setWriteTimeout(long)}
*/ public interface AioSocketChannelConfig extends SocketChannelConfig { @Override