Package org.jboss.netty.channel.socket
Class DefaultDatagramChannelConfig
java.lang.Object
org.jboss.netty.channel.DefaultChannelConfig
org.jboss.netty.channel.socket.DefaultDatagramChannelConfig
- All Implemented Interfaces:
ChannelConfig
,DatagramChannelConfig
- Direct Known Subclasses:
DefaultNioDatagramChannelConfig
public class DefaultDatagramChannelConfig
extends DefaultChannelConfig
implements DatagramChannelConfig
The default
DatagramChannelConfig
implementation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ReceiveBufferSizePredictorFactory
private ReceiveBufferSizePredictor
private final DatagramSocket
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the address of the network interface used for multicast packets.Gets theStandardSocketOptions.IP_MULTICAST_IF
option.int
Gets theStandardSocketOptions.SO_RCVBUF
option.Returns theReceiveBufferSizePredictor
which predicts the number of readable bytes in the socket receive buffer.Returns theReceiveBufferSizePredictorFactory
which creates a newReceiveBufferSizePredictor
when a new channel is created and noReceiveBufferSizePredictor
was set.int
Gets theStandardSocketOptions.SO_SNDBUF
option.int
Gets theStandardSocketOptions.IP_MULTICAST_TTL
option.int
Gets theStandardSocketOptions.IP_TOS
option.boolean
Gets theStandardSocketOptions.SO_BROADCAST
option.boolean
Gets theStandardSocketOptions.IP_MULTICAST_LOOP
option.boolean
Gets theStandardSocketOptions.SO_REUSEADDR
option.void
setBroadcast
(boolean broadcast) Sets theStandardSocketOptions.SO_BROADCAST
option.void
setInterface
(InetAddress interfaceAddress) Sets the address of the network interface used for multicast packets.void
setLoopbackModeDisabled
(boolean loopbackModeDisabled) Sets theStandardSocketOptions.IP_MULTICAST_LOOP
option.void
setNetworkInterface
(NetworkInterface networkInterface) Sets theStandardSocketOptions.IP_MULTICAST_IF
option.boolean
Sets a configuration property with the specified name and value.void
setReceiveBufferSize
(int receiveBufferSize) Sets theStandardSocketOptions.SO_RCVBUF
option.void
Sets theReceiveBufferSizePredictor
which predicts the number of readable bytes in the socket receive buffer.void
setReceiveBufferSizePredictorFactory
(ReceiveBufferSizePredictorFactory predictorFactory) Sets theReceiveBufferSizePredictor
which creates a newReceiveBufferSizePredictor
when a new channel is created and noReceiveBufferSizePredictor
was set.void
setReuseAddress
(boolean reuseAddress) Sets theStandardSocketOptions.SO_REUSEADDR
option.void
setSendBufferSize
(int sendBufferSize) Sets theStandardSocketOptions.SO_SNDBUF
option.void
setTimeToLive
(int ttl) Sets theStandardSocketOptions.IP_MULTICAST_TTL
option.void
setTrafficClass
(int trafficClass) Gets theStandardSocketOptions.IP_TOS
option.Methods inherited from class org.jboss.netty.channel.DefaultChannelConfig
getBufferFactory, getConnectTimeoutMillis, getPipelineFactory, setBufferFactory, setConnectTimeoutMillis, setOptions, setPipelineFactory
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jboss.netty.channel.ChannelConfig
getBufferFactory, getConnectTimeoutMillis, getPipelineFactory, setBufferFactory, setConnectTimeoutMillis, setOptions, setPipelineFactory
-
Field Details
-
DEFAULT_PREDICTOR_FACTORY
-
socket
-
predictor
-
predictorFactory
-
-
Constructor Details
-
DefaultDatagramChannelConfig
Creates a new instance.
-
-
Method Details
-
setOption
Description copied from interface:ChannelConfig
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; }
- Specified by:
setOption
in interfaceChannelConfig
- Overrides:
setOption
in classDefaultChannelConfig
- Returns:
true
if and only if the property has been set
-
isBroadcast
public boolean isBroadcast()Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.SO_BROADCAST
option.- Specified by:
isBroadcast
in interfaceDatagramChannelConfig
-
setBroadcast
public void setBroadcast(boolean broadcast) Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.SO_BROADCAST
option.- Specified by:
setBroadcast
in interfaceDatagramChannelConfig
-
getInterface
Description copied from interface:DatagramChannelConfig
Gets the address of the network interface used for multicast packets.- Specified by:
getInterface
in interfaceDatagramChannelConfig
-
setInterface
Description copied from interface:DatagramChannelConfig
Sets the address of the network interface used for multicast packets.- Specified by:
setInterface
in interfaceDatagramChannelConfig
-
isLoopbackModeDisabled
public boolean isLoopbackModeDisabled()Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_MULTICAST_LOOP
option.- Specified by:
isLoopbackModeDisabled
in interfaceDatagramChannelConfig
-
setLoopbackModeDisabled
public void setLoopbackModeDisabled(boolean loopbackModeDisabled) Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_LOOP
option.- Specified by:
setLoopbackModeDisabled
in interfaceDatagramChannelConfig
- Parameters:
loopbackModeDisabled
-true
if and only if the loopback mode has been disabled
-
getNetworkInterface
Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_MULTICAST_IF
option.- Specified by:
getNetworkInterface
in interfaceDatagramChannelConfig
-
setNetworkInterface
Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_IF
option.- Specified by:
setNetworkInterface
in interfaceDatagramChannelConfig
-
isReuseAddress
public boolean isReuseAddress()Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.SO_REUSEADDR
option.- Specified by:
isReuseAddress
in interfaceDatagramChannelConfig
-
setReuseAddress
public void setReuseAddress(boolean reuseAddress) Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.SO_REUSEADDR
option.- Specified by:
setReuseAddress
in interfaceDatagramChannelConfig
-
getReceiveBufferSize
public int getReceiveBufferSize()Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.SO_RCVBUF
option.- Specified by:
getReceiveBufferSize
in interfaceDatagramChannelConfig
-
setReceiveBufferSize
public void setReceiveBufferSize(int receiveBufferSize) Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.SO_RCVBUF
option.- Specified by:
setReceiveBufferSize
in interfaceDatagramChannelConfig
-
getSendBufferSize
public int getSendBufferSize()Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.SO_SNDBUF
option.- Specified by:
getSendBufferSize
in interfaceDatagramChannelConfig
-
setSendBufferSize
public void setSendBufferSize(int sendBufferSize) Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.SO_SNDBUF
option.- Specified by:
setSendBufferSize
in interfaceDatagramChannelConfig
-
getTimeToLive
public int getTimeToLive()Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_MULTICAST_TTL
option.- Specified by:
getTimeToLive
in interfaceDatagramChannelConfig
-
setTimeToLive
public void setTimeToLive(int ttl) Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_TTL
option.- Specified by:
setTimeToLive
in interfaceDatagramChannelConfig
-
getTrafficClass
public int getTrafficClass()Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_TOS
option.- Specified by:
getTrafficClass
in interfaceDatagramChannelConfig
-
setTrafficClass
public void setTrafficClass(int trafficClass) Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_TOS
option.- Specified by:
setTrafficClass
in interfaceDatagramChannelConfig
-
getReceiveBufferSizePredictor
Description copied from interface:DatagramChannelConfig
Returns theReceiveBufferSizePredictor
which predicts the number of readable bytes in the socket receive buffer. The default predictor isFixedReceiveBufferSizePredictor
(768).- Specified by:
getReceiveBufferSizePredictor
in interfaceDatagramChannelConfig
-
setReceiveBufferSizePredictor
Description copied from interface:DatagramChannelConfig
Sets theReceiveBufferSizePredictor
which predicts the number of readable bytes in the socket receive buffer. The default predictor isFixedReceiveBufferSizePredictor
(768).- Specified by:
setReceiveBufferSizePredictor
in interfaceDatagramChannelConfig
-
getReceiveBufferSizePredictorFactory
Description copied from interface:DatagramChannelConfig
Returns theReceiveBufferSizePredictorFactory
which creates a newReceiveBufferSizePredictor
when a new channel is created and noReceiveBufferSizePredictor
was set. If no predictor was set for the channel,DatagramChannelConfig.setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)
will be called with the new predictor. The default factory isFixedReceiveBufferSizePredictorFactory
(768).- Specified by:
getReceiveBufferSizePredictorFactory
in interfaceDatagramChannelConfig
-
setReceiveBufferSizePredictorFactory
public void setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory predictorFactory) Description copied from interface:DatagramChannelConfig
Sets theReceiveBufferSizePredictor
which creates a newReceiveBufferSizePredictor
when a new channel is created and noReceiveBufferSizePredictor
was set. If no predictor was set for the channel,DatagramChannelConfig.setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)
will be called with the new predictor. The default factory isFixedReceiveBufferSizePredictorFactory
(768).- Specified by:
setReceiveBufferSizePredictorFactory
in interfaceDatagramChannelConfig
-