org.jboss.netty.channel.socket
Class DefaultDatagramChannelConfig

java.lang.Object
  extended by org.jboss.netty.channel.DefaultChannelConfig
      extended by org.jboss.netty.channel.socket.DefaultDatagramChannelConfig
All Implemented Interfaces:
ChannelConfig, DatagramChannelConfig

public class DefaultDatagramChannelConfig
extends DefaultChannelConfig
implements DatagramChannelConfig

The default DatagramChannelConfig implementation.

Version:
$Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
Author:
The Netty Project, Trustin Lee

Constructor Summary
DefaultDatagramChannelConfig(DatagramSocket socket)
          Creates a new instance.
 
Method Summary
 InetAddress getInterface()
          Gets the address of the network interface used for multicast packets.
 NetworkInterface getNetworkInterface()
          Gets the network interface for outgoing multicast datagrams sent on the DatagramChannel.
 int getReceiveBufferSize()
          Gets the 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 SO_SNDBUF option.
 int getTimeToLive()
          Gets the default time-to-live for multicast packets sent out on the socket.
 int getTrafficClass()
          Gets the traffic class.
 boolean isBroadcast()
          Gets the SO_BROADCAST option.
 boolean isLoopbackModeDisabled()
          Gets the setting for local loopback of multicast datagrams.
 boolean isReuseAddress()
          Gets the SO_REUSEADDR option.
 void setBroadcast(boolean broadcast)
          Sets the SO_BROADCAST option.
 void setInterface(InetAddress interfaceAddress)
          Sets the address of the network interface used for multicast packets.
 void setLoopbackModeDisabled(boolean loopbackModeDisabled)
          Sets the setting for local loopback of multicast datagrams.
 void setNetworkInterface(NetworkInterface networkInterface)
          Sets the network interface for outgoing multicast datagrams sent on the DatagramChannel.
 boolean setOption(String key, Object value)
          Sets a configuration property with the specified name and value.
 void setReceiveBufferSize(int receiveBufferSize)
          Gets the 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 SO_REUSEADDR option.
 void setSendBufferSize(int sendBufferSize)
          Sets the SO_SNDBUF option.
 void setTimeToLive(int ttl)
          Sets the default time-to-live for multicast packets sent out on the DatagramChannel in order to control the scope of the multicasts.
 void setTrafficClass(int trafficClass)
          Sets the traffic class as specified in DatagramSocket.setTrafficClass(int).
 
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
 

Constructor Detail

DefaultDatagramChannelConfig

public DefaultDatagramChannelConfig(DatagramSocket socket)
Creates a new instance.

Method Detail

setOption

public boolean setOption(String key,
                         Object value)
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 interface ChannelConfig
Overrides:
setOption in class DefaultChannelConfig
Returns:
true if and only if the property has been set

isBroadcast

public boolean isBroadcast()
Description copied from interface: DatagramChannelConfig
Gets the SO_BROADCAST option.

Specified by:
isBroadcast in interface DatagramChannelConfig

setBroadcast

public void setBroadcast(boolean broadcast)
Description copied from interface: DatagramChannelConfig
Sets the SO_BROADCAST option.

Specified by:
setBroadcast in interface DatagramChannelConfig

getInterface

public InetAddress getInterface()
Description copied from interface: DatagramChannelConfig
Gets the address of the network interface used for multicast packets.

Specified by:
getInterface in interface DatagramChannelConfig

setInterface

public void setInterface(InetAddress interfaceAddress)
Description copied from interface: DatagramChannelConfig
Sets the address of the network interface used for multicast packets.

Specified by:
setInterface in interface DatagramChannelConfig

isLoopbackModeDisabled

public boolean isLoopbackModeDisabled()
Description copied from interface: DatagramChannelConfig
Gets the setting for local loopback of multicast datagrams.

Specified by:
isLoopbackModeDisabled in interface DatagramChannelConfig
Returns:
true if and only if the loopback mode has been disabled

setLoopbackModeDisabled

public void setLoopbackModeDisabled(boolean loopbackModeDisabled)
Description copied from interface: DatagramChannelConfig
Sets the setting for local loopback of multicast datagrams.

Specified by:
setLoopbackModeDisabled in interface DatagramChannelConfig
Parameters:
loopbackModeDisabled - true if and only if the loopback mode has been disabled

getNetworkInterface

public NetworkInterface getNetworkInterface()
Description copied from interface: DatagramChannelConfig
Gets the network interface for outgoing multicast datagrams sent on the DatagramChannel.

Specified by:
getNetworkInterface in interface DatagramChannelConfig

setNetworkInterface

public void setNetworkInterface(NetworkInterface networkInterface)
Description copied from interface: DatagramChannelConfig
Sets the network interface for outgoing multicast datagrams sent on the DatagramChannel.

Specified by:
setNetworkInterface in interface DatagramChannelConfig

isReuseAddress

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

Specified by:
isReuseAddress in interface DatagramChannelConfig

setReuseAddress

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

Specified by:
setReuseAddress in interface DatagramChannelConfig

getReceiveBufferSize

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

Specified by:
getReceiveBufferSize in interface DatagramChannelConfig

setReceiveBufferSize

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

Specified by:
setReceiveBufferSize in interface DatagramChannelConfig

getSendBufferSize

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

Specified by:
getSendBufferSize in interface DatagramChannelConfig

setSendBufferSize

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

Specified by:
setSendBufferSize in interface DatagramChannelConfig

getTimeToLive

public int getTimeToLive()
Description copied from interface: DatagramChannelConfig
Gets the default time-to-live for multicast packets sent out on the socket.

Specified by:
getTimeToLive in interface DatagramChannelConfig

setTimeToLive

public void setTimeToLive(int ttl)
Description copied from interface: DatagramChannelConfig
Sets the default time-to-live for multicast packets sent out on the DatagramChannel in order to control the scope of the multicasts.

Specified by:
setTimeToLive in interface DatagramChannelConfig

getTrafficClass

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

Specified by:
getTrafficClass in interface DatagramChannelConfig

setTrafficClass

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

Specified by:
setTrafficClass in interface DatagramChannelConfig

getReceiveBufferSizePredictor

public ReceiveBufferSizePredictor getReceiveBufferSizePredictor()
Description copied from interface: DatagramChannelConfig
Returns the ReceiveBufferSizePredictor which predicts the number of readable bytes in the socket receive buffer. The default predictor is FixedReceiveBufferSizePredictor(768).

Specified by:
getReceiveBufferSizePredictor in interface DatagramChannelConfig

setReceiveBufferSizePredictor

public void setReceiveBufferSizePredictor(ReceiveBufferSizePredictor predictor)
Description copied from interface: DatagramChannelConfig
Sets the ReceiveBufferSizePredictor which predicts the number of readable bytes in the socket receive buffer. The default predictor is FixedReceiveBufferSizePredictor(768).

Specified by:
setReceiveBufferSizePredictor in interface DatagramChannelConfig

getReceiveBufferSizePredictorFactory

public ReceiveBufferSizePredictorFactory getReceiveBufferSizePredictorFactory()
Description copied from interface: DatagramChannelConfig
Returns the ReceiveBufferSizePredictorFactory 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).

Specified by:
getReceiveBufferSizePredictorFactory in interface DatagramChannelConfig

setReceiveBufferSizePredictorFactory

public void setReceiveBufferSizePredictorFactory(ReceiveBufferSizePredictorFactory predictorFactory)
Description copied from interface: DatagramChannelConfig
Sets the ReceiveBufferSizePredictor 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).

Specified by:
setReceiveBufferSizePredictorFactory in interface DatagramChannelConfig


Copyright © 2008-2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.