diff --git a/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java b/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java index 7bbe746fa8..84ed871fc2 100644 --- a/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java @@ -31,6 +31,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelConfig; import org.jboss.netty.channel.ChannelFactory; import org.jboss.netty.channel.ChannelFuture; import org.jboss.netty.channel.ChannelHandlerContext; @@ -59,6 +60,9 @@ import org.jboss.netty.channel.SimpleChannelHandler; * b.setOption("receiveBufferSize", 1048576); * * + * For the detailed list of available options, please refer to + * {@link ChannelConfig} and its sub-types + * *

Configuring a channel pipeline

* * Every channel has its own {@link ChannelPipeline} and you can configure it diff --git a/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java b/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java index 5e1887c6b0..0bb787dbbc 100644 --- a/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java @@ -34,6 +34,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelConfig; import org.jboss.netty.channel.ChannelException; import org.jboss.netty.channel.ChannelFactory; import org.jboss.netty.channel.ChannelFuture; @@ -80,6 +81,9 @@ import org.jboss.netty.channel.SimpleChannelHandler; * b.setOption("child.receiveBufferSize", 1048576); * * + * For the detailed list of available options, please refer to + * {@link ChannelConfig} and its sub-types. + * *

Configuring a parent channel pipeline

* * It is rare to configure the pipeline of a parent channel because what it's diff --git a/src/main/java/org/jboss/netty/channel/ChannelConfig.java b/src/main/java/org/jboss/netty/channel/ChannelConfig.java index e03571a970..330f0b04ac 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/ChannelConfig.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.Map; import org.jboss.netty.channel.socket.SocketChannelConfig; +import org.jboss.netty.channel.socket.nio.NioSocketChannelConfig; /** @@ -40,6 +41,29 @@ import org.jboss.netty.channel.socket.SocketChannelConfig; * cfg.setTcpNoDelay(false); * * + *

Option map

+ * + * An option map property is a dynamic write-only property which allows + * the configuration of a {@link Channel} without down-casting its associated + * {@link ChannelConfig}. To update an option map, please call {@link #setOptions(Map)}. + *

+ * All {@link ChannelConfig} has the following options: + * + * + * + * + * + * + * + * + * + * + *
NameAssociated setter method
{@code "connectTimeoutMillis"}{@link #setConnectTimeoutMillis(int)}
{@code "writeTimeoutMillis"}{@link #setWriteTimeoutMillis(int)}
{@code "pipelineFactory"}{@link #setPipelineFactory(ChannelPipelineFactory)}
+ * + * More options are available in the sub-types of {@link ChannelConfig}. For + * example, you can configure the parameters which are specific to a TCP/IP + * socket as explained in {@link SocketChannelConfig} or {@link NioSocketChannelConfig}. + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Trustin Lee (tlee@redhat.com) * diff --git a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java index f7a443caa0..1be6b28cc4 100644 --- a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java @@ -29,6 +29,23 @@ import org.jboss.netty.channel.ChannelConfig; /** * A {@link ChannelConfig} for a {@link ServerSocketChannel}. * + *

Available options

+ * + * In addition to the options provided by {@link ChannelConfig}, + * {@link ServerSocketChannelConfig} allows the following options in the + * option map: + * + * + * + * + * + * + * + * + * + * + *
NameAssociated setter method
{@code "backlog"}{@link #setBacklog(int)}
{@code "reuseAddress"}{@link #setReuseAddress(boolean)}
{@code "receiveBufferSize"}{@link #setReceiveBufferSize(int)}
+ * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Trustin Lee (tlee@redhat.com) * diff --git a/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java index 9f260d0fb9..6b06884965 100644 --- a/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java @@ -29,6 +29,30 @@ import org.jboss.netty.channel.ChannelConfig; /** * A {@link ChannelConfig} for a {@link SocketChannel}. * + *

Available options

+ * + * In addition to the options provided by {@link ChannelConfig}, + * {@link SocketChannelConfig} allows the following options in the option map: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameAssociated setter method
{@code "keepAlive"}{@link #setKeepAlive(boolean)}
{@code "reuseAddress"}{@link #setReuseAddress(boolean)}
{@code "soLinger"}{@link #setSoLinger(int)}
{@code "tcpNoDelay"}{@link #setTcpNoDelay(boolean)}
{@code "receiveBufferSize"}{@link #setReceiveBufferSize(int)}
{@code "sendBufferSize"}{@link #setSendBufferSize(int)}
{@code "trafficClass"}{@link #setTrafficClass(int)}
+ * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Trustin Lee (tlee@redhat.com) * diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java index 92f2a5d928..c9dc0934c3 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java @@ -25,12 +25,30 @@ package org.jboss.netty.channel.socket.nio; import java.nio.ByteBuffer; import java.nio.channels.WritableByteChannel; +import org.jboss.netty.channel.ChannelConfig; import org.jboss.netty.channel.socket.SocketChannel; import org.jboss.netty.channel.socket.SocketChannelConfig; /** * A {@link SocketChannelConfig} for a NIO TCP/IP {@link SocketChannel}. * + *

Available options

+ * + * In addition to the options provided by {@link ChannelConfig} and + * {@link SocketChannelConfig}, {@link NioSocketChannelConfig} allows the + * following options in the option map: + * + * + * + * + * + * + * + * + * + * + *
NameAssociated setter method
{@code "writeSpinCount"}{@link #setWriteSpinCount(int)}
{@code "receiveBufferSizePredictor"}{@link #setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)}
{@code "readWriteFair"}{@link #setReadWriteFair(boolean)}
+ * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Trustin Lee (tlee@redhat.com) *