public class DefaultDatagramChannelConfig extends DefaultChannelConfig implements DatagramChannelConfig
DatagramChannelConfig implementation.| Modifier and Type | Field and Description |
|---|---|
private static ReceiveBufferSizePredictorFactory |
DEFAULT_PREDICTOR_FACTORY |
private ReceiveBufferSizePredictor |
predictor |
private ReceiveBufferSizePredictorFactory |
predictorFactory |
private java.net.DatagramSocket |
socket |
| Constructor and Description |
|---|
DefaultDatagramChannelConfig(java.net.DatagramSocket socket)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
java.net.InetAddress |
getInterface()
Gets the address of the network interface used for multicast packets.
|
java.net.NetworkInterface |
getNetworkInterface()
Gets the
StandardSocketOptions.IP_MULTICAST_IF option. |
int |
getReceiveBufferSize()
Gets the
StandardSocketOptions.SO_RCVBUF option. |
ReceiveBufferSizePredictor |
getReceiveBufferSizePredictor()
Returns the
ReceiveBufferSizePredictor which predicts the
number of readable bytes in the socket receive buffer. |
ReceiveBufferSizePredictorFactory |
getReceiveBufferSizePredictorFactory()
Returns the
ReceiveBufferSizePredictorFactory which creates a new
ReceiveBufferSizePredictor when a new channel is created and
no ReceiveBufferSizePredictor was set. |
int |
getSendBufferSize()
Gets the
StandardSocketOptions.SO_SNDBUF option. |
int |
getTimeToLive()
Gets the
StandardSocketOptions.IP_MULTICAST_TTL option. |
int |
getTrafficClass()
Gets the
StandardSocketOptions.IP_TOS option. |
boolean |
isBroadcast()
Gets the
StandardSocketOptions.SO_BROADCAST option. |
boolean |
isLoopbackModeDisabled()
Gets the
StandardSocketOptions.IP_MULTICAST_LOOP option. |
boolean |
isReuseAddress()
Gets the
StandardSocketOptions.SO_REUSEADDR option. |
void |
setBroadcast(boolean broadcast)
Sets the
StandardSocketOptions.SO_BROADCAST option. |
void |
setInterface(java.net.InetAddress interfaceAddress)
Sets the address of the network interface used for multicast packets.
|
void |
setLoopbackModeDisabled(boolean loopbackModeDisabled)
Sets the
StandardSocketOptions.IP_MULTICAST_LOOP option. |
void |
setNetworkInterface(java.net.NetworkInterface networkInterface)
Sets the
StandardSocketOptions.IP_MULTICAST_IF option. |
boolean |
setOption(java.lang.String key,
java.lang.Object value)
Sets a configuration property with the specified name and value.
|
void |
setReceiveBufferSize(int receiveBufferSize)
Sets the
StandardSocketOptions.SO_RCVBUF option. |
void |
setReceiveBufferSizePredictor(ReceiveBufferSizePredictor predictor)
Sets the
ReceiveBufferSizePredictor which predicts the
number of readable bytes in the socket receive buffer. |
void |
setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory predictorFactory)
Sets the
ReceiveBufferSizePredictor which creates a new
ReceiveBufferSizePredictor when a new channel is created and
no ReceiveBufferSizePredictor was set. |
void |
setReuseAddress(boolean reuseAddress)
Sets the
StandardSocketOptions.SO_REUSEADDR option. |
void |
setSendBufferSize(int sendBufferSize)
Sets the
StandardSocketOptions.SO_SNDBUF option. |
void |
setTimeToLive(int ttl)
Sets the
StandardSocketOptions.IP_MULTICAST_TTL option. |
void |
setTrafficClass(int trafficClass)
Gets the
StandardSocketOptions.IP_TOS option. |
getBufferFactory, getConnectTimeoutMillis, getPipelineFactory, setBufferFactory, setConnectTimeoutMillis, setOptions, setPipelineFactoryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBufferFactory, getConnectTimeoutMillis, getPipelineFactory, setBufferFactory, setConnectTimeoutMillis, setOptions, setPipelineFactoryprivate static final ReceiveBufferSizePredictorFactory DEFAULT_PREDICTOR_FACTORY
private final java.net.DatagramSocket socket
private volatile ReceiveBufferSizePredictor predictor
private volatile ReceiveBufferSizePredictorFactory predictorFactory
public DefaultDatagramChannelConfig(java.net.DatagramSocket socket)
public boolean setOption(java.lang.String key,
java.lang.Object value)
ChannelConfig
public boolean setOption(String name, Object value) {
if (super.setOption(name, value)) {
return true;
}
if (name.equals("additionalOption")) {
....
return true;
}
return false;
}
setOption in interface ChannelConfigsetOption in class DefaultChannelConfigtrue if and only if the property has been setpublic boolean isBroadcast()
DatagramChannelConfigStandardSocketOptions.SO_BROADCAST option.isBroadcast in interface DatagramChannelConfigpublic void setBroadcast(boolean broadcast)
DatagramChannelConfigStandardSocketOptions.SO_BROADCAST option.setBroadcast in interface DatagramChannelConfigpublic java.net.InetAddress getInterface()
DatagramChannelConfiggetInterface in interface DatagramChannelConfigpublic void setInterface(java.net.InetAddress interfaceAddress)
DatagramChannelConfigsetInterface in interface DatagramChannelConfigpublic boolean isLoopbackModeDisabled()
DatagramChannelConfigStandardSocketOptions.IP_MULTICAST_LOOP option.isLoopbackModeDisabled in interface DatagramChannelConfigpublic void setLoopbackModeDisabled(boolean loopbackModeDisabled)
DatagramChannelConfigStandardSocketOptions.IP_MULTICAST_LOOP option.setLoopbackModeDisabled in interface DatagramChannelConfigloopbackModeDisabled - true if and only if the loopback mode has been disabledpublic java.net.NetworkInterface getNetworkInterface()
DatagramChannelConfigStandardSocketOptions.IP_MULTICAST_IF option.getNetworkInterface in interface DatagramChannelConfigpublic void setNetworkInterface(java.net.NetworkInterface networkInterface)
DatagramChannelConfigStandardSocketOptions.IP_MULTICAST_IF option.setNetworkInterface in interface DatagramChannelConfigpublic boolean isReuseAddress()
DatagramChannelConfigStandardSocketOptions.SO_REUSEADDR option.isReuseAddress in interface DatagramChannelConfigpublic void setReuseAddress(boolean reuseAddress)
DatagramChannelConfigStandardSocketOptions.SO_REUSEADDR option.setReuseAddress in interface DatagramChannelConfigpublic int getReceiveBufferSize()
DatagramChannelConfigStandardSocketOptions.SO_RCVBUF option.getReceiveBufferSize in interface DatagramChannelConfigpublic void setReceiveBufferSize(int receiveBufferSize)
DatagramChannelConfigStandardSocketOptions.SO_RCVBUF option.setReceiveBufferSize in interface DatagramChannelConfigpublic int getSendBufferSize()
DatagramChannelConfigStandardSocketOptions.SO_SNDBUF option.getSendBufferSize in interface DatagramChannelConfigpublic void setSendBufferSize(int sendBufferSize)
DatagramChannelConfigStandardSocketOptions.SO_SNDBUF option.setSendBufferSize in interface DatagramChannelConfigpublic int getTimeToLive()
DatagramChannelConfigStandardSocketOptions.IP_MULTICAST_TTL option.getTimeToLive in interface DatagramChannelConfigpublic void setTimeToLive(int ttl)
DatagramChannelConfigStandardSocketOptions.IP_MULTICAST_TTL option.setTimeToLive in interface DatagramChannelConfigpublic int getTrafficClass()
DatagramChannelConfigStandardSocketOptions.IP_TOS option.getTrafficClass in interface DatagramChannelConfigpublic void setTrafficClass(int trafficClass)
DatagramChannelConfigStandardSocketOptions.IP_TOS option.setTrafficClass in interface DatagramChannelConfigpublic ReceiveBufferSizePredictor getReceiveBufferSizePredictor()
DatagramChannelConfigReceiveBufferSizePredictor which predicts the
number of readable bytes in the socket receive buffer. The default
predictor is FixedReceiveBufferSizePredictor(768).getReceiveBufferSizePredictor in interface DatagramChannelConfigpublic void setReceiveBufferSizePredictor(ReceiveBufferSizePredictor predictor)
DatagramChannelConfigReceiveBufferSizePredictor which predicts the
number of readable bytes in the socket receive buffer. The default
predictor is FixedReceiveBufferSizePredictor(768).setReceiveBufferSizePredictor in interface DatagramChannelConfigpublic ReceiveBufferSizePredictorFactory getReceiveBufferSizePredictorFactory()
DatagramChannelConfigReceiveBufferSizePredictorFactory which creates a new
ReceiveBufferSizePredictor when a new channel is created and
no ReceiveBufferSizePredictor was set. If no predictor was set
for the channel, DatagramChannelConfig.setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)
will be called with the new predictor. The default factory is
FixedReceiveBufferSizePredictorFactory(768).getReceiveBufferSizePredictorFactory in interface DatagramChannelConfigpublic void setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory predictorFactory)
DatagramChannelConfigReceiveBufferSizePredictor which creates a new
ReceiveBufferSizePredictor when a new channel is created and
no ReceiveBufferSizePredictor was set. If no predictor was set
for the channel, DatagramChannelConfig.setReceiveBufferSizePredictor(ReceiveBufferSizePredictor)
will be called with the new predictor. The default factory is
FixedReceiveBufferSizePredictorFactory(768).setReceiveBufferSizePredictorFactory in interface DatagramChannelConfig