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,java.nio.channels.DatagramChannel>
org.apache.mina.transport.socket.nio.NioDatagramAcceptor
- All Implemented Interfaces:
- IoAcceptor, IoService, DatagramAcceptor
public final class NioDatagramAcceptor
- extends AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- implements DatagramAcceptor
IoAcceptor
for datagram transport (UDP/IP).
- Author:
- Apache MINA Project
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, dispose, executeWorker, executeWorker, finishSessionInitialization0, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getListeners, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, initSession, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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, 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(java.util.concurrent.Executor executor)
- Creates a new instance.
init
protected void init()
throws java.lang.Exception
- Specified by:
init
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.Exception
destroy
protected void destroy()
throws java.lang.Exception
- Specified by:
destroy
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.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 java.net.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 java.net.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(java.net.InetSocketAddress localAddress)
- Specified by:
setDefaultLocalAddress
in interface DatagramAcceptor
open
protected java.nio.channels.DatagramChannel open(java.net.SocketAddress localAddress)
throws java.lang.Exception
- Specified by:
open
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.Exception
isReadable
protected boolean isReadable(java.nio.channels.DatagramChannel handle)
- Specified by:
isReadable
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
isWritable
protected boolean isWritable(java.nio.channels.DatagramChannel handle)
- Specified by:
isWritable
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
localAddress
protected java.net.SocketAddress localAddress(java.nio.channels.DatagramChannel handle)
throws java.lang.Exception
- Specified by:
localAddress
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.Exception
newSession
protected NioSession newSession(IoProcessor<NioSession> processor,
java.nio.channels.DatagramChannel handle,
java.net.SocketAddress remoteAddress)
- Specified by:
newSession
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
receive
protected java.net.SocketAddress receive(java.nio.channels.DatagramChannel handle,
IoBuffer buffer)
throws java.lang.Exception
- Specified by:
receive
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.Exception
select
protected int select()
throws java.lang.Exception
- Specified by:
select
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.Exception
select
protected int select(long timeout)
throws java.lang.Exception
- Specified by:
select
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.Exception
selectedHandles
protected java.util.Iterator<java.nio.channels.DatagramChannel> selectedHandles()
- Specified by:
selectedHandles
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
send
protected int send(NioSession session,
IoBuffer buffer,
java.net.SocketAddress remoteAddress)
throws java.lang.Exception
- Specified by:
send
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.Exception
setInterestedInWrite
protected void setInterestedInWrite(NioSession session,
boolean isInterested)
throws java.lang.Exception
- Specified by:
setInterestedInWrite
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.Exception
close
protected void close(java.nio.channels.DatagramChannel handle)
throws java.lang.Exception
- Specified by:
close
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
- Throws:
java.lang.Exception
wakeup
protected void wakeup()
- Specified by:
wakeup
in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>
Copyright © 2004-2011 Apache MINA Project. All Rights Reserved.