org.apache.mina.transport.socket.nio
Class NioDatagramConnector

java.lang.Object
  extended by org.apache.mina.common.AbstractIoService
      extended by org.apache.mina.common.AbstractIoConnector
          extended by org.apache.mina.common.AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
              extended by org.apache.mina.transport.socket.nio.NioDatagramConnector
All Implemented Interfaces:
IoConnector, IoService, DatagramConnector, DatagramService

public final class NioDatagramConnector
extends AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
implements DatagramConnector

IoConnector for datagram transport (UDP/IP).

Version:
$Rev: 600803 $, $Date: 2007-12-04 07:38:46 +0100 (Tue, 04 Dec 2007) $
Author:
The Apache MINA Project (dev@mina.apache.org)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.mina.common.AbstractPollingIoConnector
AbstractPollingIoConnector.ConnectionRequest
 
Nested classes/interfaces inherited from class org.apache.mina.common.AbstractIoService
AbstractIoService.ServiceOperationFuture
 
Constructor Summary
NioDatagramConnector()
          Creates a new instance.
NioDatagramConnector(int processorCount)
          Creates a new instance.
NioDatagramConnector(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor)
          Creates a new instance.
 
Method Summary
protected  Iterator<DatagramChannel> allHandles()
           
protected  void close(DatagramChannel handle)
           
protected  boolean connect(DatagramChannel handle, SocketAddress remoteAddress)
           
protected  AbstractPollingIoConnector.ConnectionRequest connectionRequest(DatagramChannel handle)
           
protected  void destroy()
           
protected  boolean finishConnect(DatagramChannel handle)
           
 InetSocketAddress getDefaultRemoteAddress()
          Returns the default remote address to connect to when no argument is specified in IoConnector.connect() method.
 DatagramSessionConfig getSessionConfig()
          Returns the default configuration of the new IoSessions created by this service.
 TransportMetadata getTransportMetadata()
          Returns the TransportMetadata that this service runs on.
protected  void init()
           
protected  DatagramChannel newHandle(SocketAddress localAddress)
           
protected  org.apache.mina.transport.socket.nio.NioSession newSession(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor, DatagramChannel handle)
           
protected  void register(DatagramChannel handle, AbstractPollingIoConnector.ConnectionRequest request)
           
protected  boolean select(int timeout)
           
protected  Iterator<DatagramChannel> selectedHandles()
           
 void setDefaultRemoteAddress(InetSocketAddress defaultRemoteAddress)
           
protected  void wakeup()
           
 
Methods inherited from class org.apache.mina.common.AbstractPollingIoConnector
connect0, dispose0
 
Methods inherited from class org.apache.mina.common.AbstractIoConnector
connect, connect, connect, connect, connect, connect, finishSessionInitialization0, getConnectTimeout, getConnectTimeoutMillis, setConnectTimeout, setDefaultRemoteAddress, toString
 
Methods inherited from class org.apache.mina.common.AbstractIoService
addListener, broadcast, decreaseScheduledWriteMessages, dispose, finishSessionInitialization, getActivationTime, getBothIdleCount, getBothIdleTime, getBothIdleTimeInMillis, getCumulativeManagedSessionCount, getFilterChain, getFilterChainBuilder, getHandler, getIdleCount, getIdleTime, getIdleTimeInMillis, getLargestManagedSessionCount, getLargestReadBytesThroughput, getLargestReadMessagesThroughput, getLargestWrittenBytesThroughput, getLargestWrittenMessagesThroughput, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getListeners, getManagedSessionCount, getManagedSessions, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReaderIdleTime, getReaderIdleTimeInMillis, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleCount, getWriterIdleTime, getWriterIdleTimeInMillis, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, increaseReadBytes, increaseReadMessages, increaseScheduledWriteBytes, increaseScheduledWriteMessages, increaseWrittenBytes, increaseWrittenMessages, isActive, isBothIdle, isDisposed, isDisposing, isIdle, isReaderIdle, isWriterIdle, notifyIdleness, removeListener, setBothIdleTime, setFilterChainBuilder, setHandler, setIdleTime, setLastReadTime, setLastWriteTime, setReaderIdleTime, setSessionDataStructureFactory, setThroughputCalculationInterval, setWriterIdleTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.mina.common.IoService
addListener, broadcast, dispose, getActivationTime, getBothIdleCount, getBothIdleTime, getBothIdleTimeInMillis, getCumulativeManagedSessionCount, getFilterChain, getFilterChainBuilder, getHandler, getIdleCount, getIdleTime, getIdleTimeInMillis, getLargestManagedSessionCount, getLargestReadBytesThroughput, getLargestReadMessagesThroughput, getLargestWrittenBytesThroughput, getLargestWrittenMessagesThroughput, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getManagedSessionCount, getManagedSessions, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReaderIdleTime, getReaderIdleTimeInMillis, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleCount, getWriterIdleTime, getWriterIdleTimeInMillis, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, isActive, isBothIdle, isDisposed, isDisposing, isIdle, isReaderIdle, isWriterIdle, removeListener, setBothIdleTime, setFilterChainBuilder, setHandler, setIdleTime, setReaderIdleTime, setSessionDataStructureFactory, setThroughputCalculationInterval, setWriterIdleTime
 
Methods inherited from interface org.apache.mina.common.IoConnector
connect, connect, connect, connect, connect, connect, getConnectTimeout, getConnectTimeoutMillis, setConnectTimeout, setDefaultRemoteAddress
 
Methods inherited from interface org.apache.mina.common.IoService
addListener, broadcast, dispose, getActivationTime, getBothIdleCount, getBothIdleTime, getBothIdleTimeInMillis, getCumulativeManagedSessionCount, getFilterChain, getFilterChainBuilder, getHandler, getIdleCount, getIdleTime, getIdleTimeInMillis, getLargestManagedSessionCount, getLargestReadBytesThroughput, getLargestReadMessagesThroughput, getLargestWrittenBytesThroughput, getLargestWrittenMessagesThroughput, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getManagedSessionCount, getManagedSessions, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReaderIdleTime, getReaderIdleTimeInMillis, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleCount, getWriterIdleTime, getWriterIdleTimeInMillis, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, isActive, isBothIdle, isDisposed, isDisposing, isIdle, isReaderIdle, isWriterIdle, removeListener, setBothIdleTime, setFilterChainBuilder, setHandler, setIdleTime, setReaderIdleTime, setSessionDataStructureFactory, setThroughputCalculationInterval, setWriterIdleTime
 

Constructor Detail

NioDatagramConnector

public NioDatagramConnector()
Creates a new instance.


NioDatagramConnector

public NioDatagramConnector(int processorCount)
Creates a new instance.


NioDatagramConnector

public NioDatagramConnector(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor)
Creates a new instance.

Method Detail

getTransportMetadata

public TransportMetadata getTransportMetadata()
Description copied from interface: IoService
Returns the TransportMetadata that this service runs on.

Specified by:
getTransportMetadata in interface IoService

getSessionConfig

public DatagramSessionConfig getSessionConfig()
Description copied from interface: IoService
Returns the default configuration of the new IoSessions created by this service.

Specified by:
getSessionConfig in interface IoService
Specified by:
getSessionConfig in interface DatagramService
Overrides:
getSessionConfig in class AbstractIoService

getDefaultRemoteAddress

public InetSocketAddress getDefaultRemoteAddress()
Description copied from interface: IoConnector
Returns the default remote address to connect to when no argument is specified in IoConnector.connect() method.

Specified by:
getDefaultRemoteAddress in interface IoConnector
Specified by:
getDefaultRemoteAddress in interface DatagramConnector
Overrides:
getDefaultRemoteAddress in class AbstractIoConnector

setDefaultRemoteAddress

public void setDefaultRemoteAddress(InetSocketAddress defaultRemoteAddress)
Specified by:
setDefaultRemoteAddress in interface DatagramConnector

init

protected void init()
             throws Exception
Specified by:
init in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
Throws:
Exception

newHandle

protected DatagramChannel newHandle(SocketAddress localAddress)
                             throws Exception
Specified by:
newHandle in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
Throws:
Exception

connect

protected boolean connect(DatagramChannel handle,
                          SocketAddress remoteAddress)
                   throws Exception
Specified by:
connect in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
Throws:
Exception

newSession

protected org.apache.mina.transport.socket.nio.NioSession newSession(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor,
                                                                     DatagramChannel handle)
Specified by:
newSession in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>

close

protected void close(DatagramChannel handle)
              throws Exception
Specified by:
close in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
Throws:
Exception

allHandles

protected Iterator<DatagramChannel> allHandles()
Specified by:
allHandles in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>

connectionRequest

protected AbstractPollingIoConnector.ConnectionRequest connectionRequest(DatagramChannel handle)
Specified by:
connectionRequest in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>

destroy

protected void destroy()
                throws Exception
Specified by:
destroy in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
Throws:
Exception

finishConnect

protected boolean finishConnect(DatagramChannel handle)
                         throws Exception
Specified by:
finishConnect in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
Throws:
Exception

register

protected void register(DatagramChannel handle,
                        AbstractPollingIoConnector.ConnectionRequest request)
                 throws Exception
Specified by:
register in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
Throws:
Exception

select

protected boolean select(int timeout)
                  throws Exception
Specified by:
select in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>
Throws:
Exception

selectedHandles

protected Iterator<DatagramChannel> selectedHandles()
Specified by:
selectedHandles in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>

wakeup

protected void wakeup()
Specified by:
wakeup in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,DatagramChannel>


Copyright © 2004-2009 Apache MINA Project. All Rights Reserved.