org.apache.mina.transport.socket.nio.support
Class DatagramAcceptorDelegate

java.lang.Object
  extended by org.apache.mina.common.support.BaseIoService
      extended by org.apache.mina.common.support.BaseIoAcceptor
          extended by org.apache.mina.transport.socket.nio.support.DatagramAcceptorDelegate
All Implemented Interfaces:
IoAcceptor, IoService

public class DatagramAcceptorDelegate
extends BaseIoAcceptor
implements IoAcceptor

IoAcceptor for datagram transport (UDP/IP).


Constructor Summary
DatagramAcceptorDelegate(IoAcceptor wrapper, java.util.concurrent.Executor executor)
          Creates a new instance.
 
Method Summary
 void bind(java.net.SocketAddress address, IoHandler handler, IoServiceConfig config)
          Binds to the specified address and handles incoming connections with the specified handler.
 void closeSession(org.apache.mina.transport.socket.nio.support.DatagramSessionImpl session)
          Requests this processor to close the specified session.
 void flushSession(org.apache.mina.transport.socket.nio.support.DatagramSessionImpl session)
          Requests this processor to flush the write buffer of the specified session.
 DatagramAcceptorConfig getDefaultConfig()
          Returns the default configuration which is used when you didn't specify any configuration.
 IoServiceListenerSupport getListeners()
           
 IoSession newSession(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
          (Optional) Returns an IoSession that is bound to the specified localAddress and remoteAddress which reuses the localAddress that is already bound by IoAcceptor via IoAcceptor.bind(SocketAddress, IoHandler).
 void setDefaultConfig(DatagramAcceptorConfig defaultConfig)
          Sets the config this acceptor will use by default.
 void unbind(java.net.SocketAddress address)
          Unbinds from the specified address and disconnects all clients connected there.
 void unbindAll()
          Unbinds all addresses which were bound by this acceptor.
 void updateTrafficMask(org.apache.mina.transport.socket.nio.support.DatagramSessionImpl session)
          Requests this processor to update the traffic mask for the specified session.
 
Methods inherited from class org.apache.mina.common.support.BaseIoAcceptor
bind
 
Methods inherited from class org.apache.mina.common.support.BaseIoService
addListener, getFilterChain, getFilterChainBuilder, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, setFilterChainBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.mina.common.IoAcceptor
bind
 
Methods inherited from interface org.apache.mina.common.IoService
addListener, getFilterChain, getFilterChainBuilder, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, setFilterChainBuilder
 

Constructor Detail

DatagramAcceptorDelegate

public DatagramAcceptorDelegate(IoAcceptor wrapper,
                                java.util.concurrent.Executor executor)
Creates a new instance.

Method Detail

bind

public void bind(java.net.SocketAddress address,
                 IoHandler handler,
                 IoServiceConfig config)
          throws java.io.IOException
Description copied from interface: IoAcceptor
Binds to the specified address and handles incoming connections with the specified handler.

Specified by:
bind in interface IoAcceptor
config - the configuration
Throws:
java.io.IOException - if failed to bind

unbind

public void unbind(java.net.SocketAddress address)
Description copied from interface: IoAcceptor
Unbinds from the specified address and disconnects all clients connected there.

Specified by:
unbind in interface IoAcceptor

unbindAll

public void unbindAll()
Description copied from interface: IoAcceptor
Unbinds all addresses which were bound by this acceptor.

Specified by:
unbindAll in interface IoAcceptor

newSession

public IoSession newSession(java.net.SocketAddress remoteAddress,
                            java.net.SocketAddress localAddress)
Description copied from interface: IoAcceptor
(Optional) Returns an IoSession that is bound to the specified localAddress and remoteAddress which reuses the localAddress that is already bound by IoAcceptor via IoAcceptor.bind(SocketAddress, IoHandler).

This operation is optional. Please throw UnsupportedOperationException if the transport type doesn't support this operation. This operation is usually implemented for connectionless transport types.

Specified by:
newSession in interface IoAcceptor
Overrides:
newSession in class BaseIoAcceptor

getListeners

public IoServiceListenerSupport getListeners()
Overrides:
getListeners in class BaseIoService

getDefaultConfig

public DatagramAcceptorConfig getDefaultConfig()
Description copied from interface: IoService
Returns the default configuration which is used when you didn't specify any configuration.

Specified by:
getDefaultConfig in interface IoService

setDefaultConfig

public void setDefaultConfig(DatagramAcceptorConfig defaultConfig)
Sets the config this acceptor will use by default.

Parameters:
defaultConfig - the default config.
Throws:
java.lang.NullPointerException - if the specified value is null.

flushSession

public void flushSession(org.apache.mina.transport.socket.nio.support.DatagramSessionImpl session)
Requests this processor to flush the write buffer of the specified session. This method is invoked by MINA internally.


closeSession

public void closeSession(org.apache.mina.transport.socket.nio.support.DatagramSessionImpl session)
Requests this processor to close the specified session. This method is invoked by MINA internally.


updateTrafficMask

public void updateTrafficMask(org.apache.mina.transport.socket.nio.support.DatagramSessionImpl session)
Requests this processor to update the traffic mask for the specified session. This method is invoked by MINA internally.