Package org.jboss.netty.channel
Interface ChannelConfig
-
- All Known Subinterfaces:
DatagramChannelConfig,NioChannelConfig,NioDatagramChannelConfig,NioSocketChannelConfig,ServerSocketChannelConfig,SocketChannelConfig
- All Known Implementing Classes:
DefaultChannelConfig,DefaultDatagramChannelConfig,DefaultNioDatagramChannelConfig,DefaultNioSocketChannelConfig,DefaultServerChannelConfig,DefaultServerSocketChannelConfig,DefaultSocketChannelConfig,HttpTunnelingSocketChannelConfig
public interface ChannelConfigA set of configuration properties of aChannel.Please down-cast to more specific configuration type such as
SocketChannelConfigor usesetOptions(Map)to set the transport-specific properties:Channelch = ...;SocketChannelConfigcfg = (SocketChannelConfig) ch.getConfig(); cfg.setTcpNoDelay(false);Option map
An option map property is a dynamic write-only property which allows the configuration of aChannelwithout down-casting its associatedChannelConfig. To update an option map, please callsetOptions(Map).All
ChannelConfighas the following options:Name Associated setter method "bufferFactory"setBufferFactory(ChannelBufferFactory)"connectTimeoutMillis"setConnectTimeoutMillis(int)"pipelineFactory"setPipelineFactory(ChannelPipelineFactory)More options are available in the sub-types of
ChannelConfig. For example, you can configure the parameters which are specific to a TCP/IP socket as explained inSocketChannelConfigorNioSocketChannelConfig.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ChannelBufferFactorygetBufferFactory()Returns the defaultChannelBufferFactoryused to create a newChannelBuffer.intgetConnectTimeoutMillis()Returns the connect timeout of the channel in milliseconds.ChannelPipelineFactorygetPipelineFactory()Returns theChannelPipelineFactorywhich will be used when a child channel is created.voidsetBufferFactory(ChannelBufferFactory bufferFactory)Sets the defaultChannelBufferFactoryused to create a newChannelBuffer.voidsetConnectTimeoutMillis(int connectTimeoutMillis)Sets the connect timeout of the channel in milliseconds.booleansetOption(java.lang.String name, java.lang.Object value)Sets a configuration property with the specified name and value.voidsetOptions(java.util.Map<java.lang.String,java.lang.Object> options)Sets the configuration properties from the specifiedMap.voidsetPipelineFactory(ChannelPipelineFactory pipelineFactory)Sets theChannelPipelineFactorywhich will be used when a child channel is created.
-
-
-
Method Detail
-
setOptions
void setOptions(java.util.Map<java.lang.String,java.lang.Object> options)
Sets the configuration properties from the specifiedMap.
-
setOption
boolean setOption(java.lang.String name, java.lang.Object value)Sets a configuration property with the specified name and value. To override this method properly, you must call the super class:public boolean setOption(String name, Object value) { if (super.setOption(name, value)) { return true; } if (name.equals("additionalOption")) { .... return true; } return false; }- Returns:
trueif and only if the property has been set
-
getBufferFactory
ChannelBufferFactory getBufferFactory()
Returns the defaultChannelBufferFactoryused to create a newChannelBuffer. The default isHeapChannelBufferFactory. You can specify a different factory to change the defaultByteOrderfor example.
-
setBufferFactory
void setBufferFactory(ChannelBufferFactory bufferFactory)
Sets the defaultChannelBufferFactoryused to create a newChannelBuffer. The default isHeapChannelBufferFactory. You can specify a different factory to change the defaultByteOrderfor example.
-
getPipelineFactory
ChannelPipelineFactory getPipelineFactory()
Returns theChannelPipelineFactorywhich will be used when a child channel is created. If theChanneldoes not create a child channel, this property is not used at all, and therefore will be ignored.
-
setPipelineFactory
void setPipelineFactory(ChannelPipelineFactory pipelineFactory)
Sets theChannelPipelineFactorywhich will be used when a child channel is created. If theChanneldoes not create a child channel, this property is not used at all, and therefore will be ignored.
-
getConnectTimeoutMillis
int getConnectTimeoutMillis()
Returns the connect timeout of the channel in milliseconds. If theChanneldoes not support connect operation, this property is not used at all, and therefore will be ignored.- Returns:
- the connect timeout in milliseconds.
0if disabled.
-
setConnectTimeoutMillis
void setConnectTimeoutMillis(int connectTimeoutMillis)
Sets the connect timeout of the channel in milliseconds. If theChanneldoes not support connect operation, this property is not used at all, and therefore will be ignored.- Parameters:
connectTimeoutMillis- the connect timeout in milliseconds.0to disable.
-
-