org.apache.mina.transport.socket.nio
Class NioDatagramAcceptor
java.lang.Object
org.apache.mina.core.service.AbstractIoService
org.apache.mina.core.service.AbstractIoAcceptor
org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
org.apache.mina.transport.socket.nio.NioDatagramAcceptor
- All Implemented Interfaces:
- IoAcceptor, IoService, DatagramAcceptor
public final class NioDatagramAcceptor
- extends AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- implements DatagramAcceptor
IoAcceptor
for datagram transport (UDP/IP).
- Version:
- $Rev: 708218 $, $Date: 2008-10-27 16:16:48 +0100 (Mo, 27 Okt 2008) $
- Author:
- The Apache MINA Project (dev@mina.apache.org)
Methods inherited from class org.apache.mina.core.service.AbstractIoAcceptor |
bind, bind, bind, bind, getDefaultLocalAddresses, getLocalAddresses, isCloseOnDeactivation, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, toString, unbind, unbind, unbind, unbind |
Methods inherited from class org.apache.mina.core.service.AbstractIoService |
addListener, broadcast, dispose, executeWorker, executeWorker, finishSessionInitialization, finishSessionInitialization0, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getListeners, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory |
Methods inherited from interface org.apache.mina.core.service.IoAcceptor |
bind, bind, bind, bind, getDefaultLocalAddresses, getLocalAddresses, isCloseOnDeactivation, newSession, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, unbind, unbind, unbind, unbind |
Methods inherited from interface org.apache.mina.core.service.IoService |
addListener, broadcast, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory |
NioDatagramAcceptor
public NioDatagramAcceptor()
- Creates a new instance.
NioDatagramAcceptor
public NioDatagramAcceptor(Executor executor)
- Creates a new instance.
init
protected void init()
throws Exception
- Specified by:
init
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
destroy
protected void destroy()
throws Exception
- Specified by:
destroy
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
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 class:
AbstractIoService
- Returns the default configuration of the new
IoSession
s
created by this service.
- Specified by:
getSessionConfig
in interface IoService
- Overrides:
getSessionConfig
in class AbstractIoService
getLocalAddress
public InetSocketAddress getLocalAddress()
- Description copied from class:
AbstractIoAcceptor
- Returns the local address which is bound currently. If more than one
address are bound, only one of them will be returned, but it's not
necessarily the firstly bound address.
- Specified by:
getLocalAddress
in interface IoAcceptor
- Specified by:
getLocalAddress
in interface DatagramAcceptor
- Overrides:
getLocalAddress
in class AbstractIoAcceptor
getDefaultLocalAddress
public InetSocketAddress getDefaultLocalAddress()
- Description copied from class:
AbstractIoAcceptor
- Returns the default local address to bind when no argument is specified
in
IoAcceptor.bind()
method. Please note that the default will not be
used if any local address is specified. If more than one address are
set, only one of them will be returned, but it's not necessarily the
firstly specified address in IoAcceptor.setDefaultLocalAddresses(List)
.
- Specified by:
getDefaultLocalAddress
in interface IoAcceptor
- Specified by:
getDefaultLocalAddress
in interface DatagramAcceptor
- Overrides:
getDefaultLocalAddress
in class AbstractIoAcceptor
setDefaultLocalAddress
public void setDefaultLocalAddress(InetSocketAddress localAddress)
- Specified by:
setDefaultLocalAddress
in interface DatagramAcceptor
open
protected DatagramChannel open(SocketAddress localAddress)
throws Exception
- Specified by:
open
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
isReadable
protected boolean isReadable(DatagramChannel handle)
- Specified by:
isReadable
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
isWritable
protected boolean isWritable(DatagramChannel handle)
- Specified by:
isWritable
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
localAddress
protected SocketAddress localAddress(DatagramChannel handle)
throws Exception
- Specified by:
localAddress
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
newSession
protected NioSession newSession(IoProcessor<NioSession> processor,
DatagramChannel handle,
SocketAddress remoteAddress)
- Specified by:
newSession
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
receive
protected SocketAddress receive(DatagramChannel handle,
IoBuffer buffer)
throws Exception
- Specified by:
receive
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
select
protected int select()
throws Exception
- Specified by:
select
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
select
protected int select(int timeout)
throws Exception
- Specified by:
select
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
selectedHandles
protected Iterator<DatagramChannel> selectedHandles()
- Specified by:
selectedHandles
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
send
protected int send(NioSession session,
IoBuffer buffer,
SocketAddress remoteAddress)
throws Exception
- Specified by:
send
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
setInterestedInWrite
protected void setInterestedInWrite(NioSession session,
boolean interested)
throws Exception
- Specified by:
setInterestedInWrite
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
close
protected void close(DatagramChannel handle)
throws Exception
- Specified by:
close
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
- Throws:
Exception
wakeup
protected void wakeup()
- Specified by:
wakeup
in class AbstractPollingConnectionlessIoAcceptor<NioSession,DatagramChannel>
Copyright © 2004-2009 Apache MINA Project. All Rights Reserved.