org.jboss.netty.channel.socket
Class DefaultSocketChannelConfig

java.lang.Object
  extended by org.jboss.netty.channel.socket.DefaultSocketChannelConfig
All Implemented Interfaces:
ChannelConfig, SocketChannelConfig

public class DefaultSocketChannelConfig
extends Object
implements SocketChannelConfig

The default SocketChannelConfig implementation.

Version:
$Rev: 212 $, $Date: 2008-09-03 14:13:47 +0900 (Wed, 03 Sep 2008) $
Author:
The Netty Project (netty-dev@lists.jboss.org), Trustin Lee (tlee@redhat.com)

Constructor Summary
DefaultSocketChannelConfig(Socket socket)
          Creates a new instance.
 
Method Summary
 int getConnectTimeoutMillis()
          Returns the connect timeout of the channel in milliseconds.
 ChannelPipelineFactory getPipelineFactory()
          Returns the ChannelPipelineFactory which will be used when a child channel is created.
 int getReceiveBufferSize()
          Gets the SO_RCVBUF option.
 int getSendBufferSize()
          Gets the SO_SNDBUF option.
 int getSoLinger()
          Gets the SO_LINGER option.
 int getTrafficClass()
          Gets the traffic class.
 int getWriteTimeoutMillis()
          Returns the write timeout of the channel in milliseconds.
 boolean isKeepAlive()
          Gets the SO_KEEPALIVE option.
 boolean isReuseAddress()
          Gets the SO_REUSEADDR option.
 boolean isTcpNoDelay()
          Gets the SO_TCPNODELAY option.
 void setConnectTimeoutMillis(int connectTimeoutMillis)
          Sets the connect timeout of the channel in milliseconds.
 void setKeepAlive(boolean keepAlive)
          Sets the SO_KEEPALIVE option.
protected  boolean setOption(String key, Object value)
          Sets an individual option.
 void setOptions(Map<String,Object> options)
          Sets the configuration properties from the specified Map.
 void setPerformancePreferences(int connectionTime, int latency, int bandwidth)
          Sets the performance preferences as specified in Socket.setPerformancePreferences(int, int, int).
 void setPipelineFactory(ChannelPipelineFactory pipelineFactory)
          Sets the ChannelPipelineFactory which will be used when a child channel is created.
 void setReceiveBufferSize(int receiveBufferSize)
          Gets the SO_RCVBUF option.
 void setReuseAddress(boolean reuseAddress)
          Sets the SO_REUSEADDR option.
 void setSendBufferSize(int sendBufferSize)
          Sets the SO_SNDBUF option.
 void setSoLinger(int soLinger)
          Sets the SO_LINGER option.
 void setTcpNoDelay(boolean tcpNoDelay)
          Sets the SO_TCPNODELAY option.
 void setTrafficClass(int trafficClass)
          Sets the traffic class as specified in Socket.setTrafficClass(int).
 void setWriteTimeoutMillis(int writeTimeoutMillis)
          Sets the write timeout of the channel in milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSocketChannelConfig

public DefaultSocketChannelConfig(Socket socket)
Creates a new instance.

Method Detail

setOptions

public void setOptions(Map<String,Object> options)
Description copied from interface: ChannelConfig
Sets the configuration properties from the specified Map.

Specified by:
setOptions in interface ChannelConfig

setOption

protected boolean setOption(String key,
                            Object value)
Sets an individual option. You can override this method to support additional configuration parameters.


getReceiveBufferSize

public int getReceiveBufferSize()
Description copied from interface: SocketChannelConfig
Gets the SO_RCVBUF option.

Specified by:
getReceiveBufferSize in interface SocketChannelConfig

getSendBufferSize

public int getSendBufferSize()
Description copied from interface: SocketChannelConfig
Gets the SO_SNDBUF option.

Specified by:
getSendBufferSize in interface SocketChannelConfig

getSoLinger

public int getSoLinger()
Description copied from interface: SocketChannelConfig
Gets the SO_LINGER option.

Specified by:
getSoLinger in interface SocketChannelConfig

getTrafficClass

public int getTrafficClass()
Description copied from interface: SocketChannelConfig
Gets the traffic class.

Specified by:
getTrafficClass in interface SocketChannelConfig

isKeepAlive

public boolean isKeepAlive()
Description copied from interface: SocketChannelConfig
Gets the SO_KEEPALIVE option.

Specified by:
isKeepAlive in interface SocketChannelConfig

isReuseAddress

public boolean isReuseAddress()
Description copied from interface: SocketChannelConfig
Gets the SO_REUSEADDR option.

Specified by:
isReuseAddress in interface SocketChannelConfig

isTcpNoDelay

public boolean isTcpNoDelay()
Description copied from interface: SocketChannelConfig
Gets the SO_TCPNODELAY option.

Specified by:
isTcpNoDelay in interface SocketChannelConfig

setKeepAlive

public void setKeepAlive(boolean keepAlive)
Description copied from interface: SocketChannelConfig
Sets the SO_KEEPALIVE option.

Specified by:
setKeepAlive in interface SocketChannelConfig

setPerformancePreferences

public void setPerformancePreferences(int connectionTime,
                                      int latency,
                                      int bandwidth)
Description copied from interface: SocketChannelConfig
Sets the performance preferences as specified in Socket.setPerformancePreferences(int, int, int).

Specified by:
setPerformancePreferences in interface SocketChannelConfig

setReceiveBufferSize

public void setReceiveBufferSize(int receiveBufferSize)
Description copied from interface: SocketChannelConfig
Gets the SO_RCVBUF option.

Specified by:
setReceiveBufferSize in interface SocketChannelConfig

setReuseAddress

public void setReuseAddress(boolean reuseAddress)
Description copied from interface: SocketChannelConfig
Sets the SO_REUSEADDR option.

Specified by:
setReuseAddress in interface SocketChannelConfig

setSendBufferSize

public void setSendBufferSize(int sendBufferSize)
Description copied from interface: SocketChannelConfig
Sets the SO_SNDBUF option.

Specified by:
setSendBufferSize in interface SocketChannelConfig

setSoLinger

public void setSoLinger(int soLinger)
Description copied from interface: SocketChannelConfig
Sets the SO_LINGER option.

Specified by:
setSoLinger in interface SocketChannelConfig

setTcpNoDelay

public void setTcpNoDelay(boolean tcpNoDelay)
Description copied from interface: SocketChannelConfig
Sets the SO_TCPNODELAY option.

Specified by:
setTcpNoDelay in interface SocketChannelConfig

setTrafficClass

public void setTrafficClass(int trafficClass)
Description copied from interface: SocketChannelConfig
Sets the traffic class as specified in Socket.setTrafficClass(int).

Specified by:
setTrafficClass in interface SocketChannelConfig

getConnectTimeoutMillis

public int getConnectTimeoutMillis()
Description copied from interface: ChannelConfig
Returns the connect timeout of the channel in milliseconds. If the Channel does not support connect operation, this property is not used at all, and therefore will be ignored.

Specified by:
getConnectTimeoutMillis in interface ChannelConfig
Returns:
the connect timeout in milliseconds. 0 if disabled.

getPipelineFactory

public ChannelPipelineFactory getPipelineFactory()
Description copied from interface: ChannelConfig
Returns the ChannelPipelineFactory which will be used when a child channel is created. If the Channel does not create a child channel, this property is not used at all, and therefore will be ignored.

Specified by:
getPipelineFactory in interface ChannelConfig

getWriteTimeoutMillis

public int getWriteTimeoutMillis()
Description copied from interface: ChannelConfig
Returns the write timeout of the channel in milliseconds. If a write operation is not completed within the write timeout, an IOException will be raised. If the Channel does not support write operation, this property is not used at all, and therefore will be ignored.

Specified by:
getWriteTimeoutMillis in interface ChannelConfig
Returns:
the write timeout in milliseconds. 0 if disabled.

setConnectTimeoutMillis

public void setConnectTimeoutMillis(int connectTimeoutMillis)
Description copied from interface: ChannelConfig
Sets the connect timeout of the channel in milliseconds. If the Channel does not support connect operation, this property is not used at all, and therefore will be ignored.

Specified by:
setConnectTimeoutMillis in interface ChannelConfig
Parameters:
connectTimeoutMillis - the connect timeout in milliseconds. 0 to disable.

setPipelineFactory

public void setPipelineFactory(ChannelPipelineFactory pipelineFactory)
Description copied from interface: ChannelConfig
Sets the ChannelPipelineFactory which will be used when a child channel is created. If the Channel does not create a child channel, this property is not used at all, and therefore will be ignored.

Specified by:
setPipelineFactory in interface ChannelConfig

setWriteTimeoutMillis

public void setWriteTimeoutMillis(int writeTimeoutMillis)
Description copied from interface: ChannelConfig
Sets the write timeout of the channel in milliseconds. If a write operation is not completed within the write timeout, an IOException will be raised. If the Channel does not support write operation, this property is not used at all, and therefore will be ignored.

Specified by:
setWriteTimeoutMillis in interface ChannelConfig
Parameters:
writeTimeoutMillis - the write timeout in milliseconds. 0 to disable.


Copyright © 2008-Present JBoss - a division of Red Hat. All Rights Reserved.