public final class NioDatagramAcceptor extends AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel> implements DatagramAcceptor
IoAcceptor for datagram transport (UDP/IP).AbstractIoAcceptor.AcceptorOperationFutureAbstractIoService.ServiceOperationFuturebindLockdisposalLock| Constructor and Description |
|---|
NioDatagramAcceptor()
Creates a new instance.
|
NioDatagramAcceptor(java.util.concurrent.Executor executor)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
close(java.nio.channels.DatagramChannel handle) |
protected void |
destroy() |
java.net.InetSocketAddress |
getDefaultLocalAddress()
Returns the default local address to bind when no argument is specified
in
IoAcceptor.bind() method. |
java.net.InetSocketAddress |
getLocalAddress()
Returns the local address which is bound currently.
|
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 boolean |
isReadable(java.nio.channels.DatagramChannel handle) |
protected boolean |
isWritable(java.nio.channels.DatagramChannel handle) |
protected java.net.SocketAddress |
localAddress(java.nio.channels.DatagramChannel handle) |
protected NioSession |
newSession(IoProcessor<NioSession> processor,
java.nio.channels.DatagramChannel handle,
java.net.SocketAddress remoteAddress) |
protected java.nio.channels.DatagramChannel |
open(java.net.SocketAddress localAddress) |
protected java.net.SocketAddress |
receive(java.nio.channels.DatagramChannel handle,
IoBuffer buffer) |
protected int |
select() |
protected int |
select(long timeout) |
protected java.util.Set<java.nio.channels.SelectionKey> |
selectedHandles() |
protected int |
send(NioSession session,
IoBuffer buffer,
java.net.SocketAddress remoteAddress) |
void |
setDefaultLocalAddress(java.net.InetSocketAddress localAddress) |
protected void |
setInterestedInWrite(NioSession session,
boolean isInterested) |
protected void |
wakeup() |
add, bindInternal, dispose0, flush, getSessionRecycler, newSession, remove, setSessionRecycler, unbind0, updateTrafficControl, writebind, bind, bind, bind, bind, getDefaultLocalAddresses, getLocalAddresses, isCloseOnDeactivation, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, toString, unbind, unbind, unbind, unbindaddListener, broadcast, dispose, dispose, executeWorker, executeWorker, finishSessionInitialization0, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getListeners, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, initSession, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactoryclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSessionRecycler, setSessionRecyclerbind, bind, bind, bind, bind, getDefaultLocalAddresses, getLocalAddresses, isCloseOnDeactivation, newSession, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, unbind, unbind, unbind, unbindaddListener, broadcast, dispose, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactorydispose, isDisposed, isDisposingpublic NioDatagramAcceptor()
public NioDatagramAcceptor(java.util.concurrent.Executor executor)
protected void init()
throws java.lang.Exception
init in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionprotected void destroy()
throws java.lang.Exception
destroy in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionpublic TransportMetadata getTransportMetadata()
IoServiceTransportMetadata that this service runs on.getTransportMetadata in interface IoServicepublic DatagramSessionConfig getSessionConfig()
AbstractIoServiceIoSessions
created by this service.getSessionConfig in interface IoServicegetSessionConfig in class AbstractIoServicepublic java.net.InetSocketAddress getLocalAddress()
AbstractIoAcceptorgetLocalAddress in interface IoAcceptorgetLocalAddress in interface DatagramAcceptorgetLocalAddress in class AbstractIoAcceptorpublic java.net.InetSocketAddress getDefaultLocalAddress()
AbstractIoAcceptorIoAcceptor.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).getDefaultLocalAddress in interface IoAcceptorgetDefaultLocalAddress in interface DatagramAcceptorgetDefaultLocalAddress in class AbstractIoAcceptorpublic void setDefaultLocalAddress(java.net.InetSocketAddress localAddress)
setDefaultLocalAddress in interface DatagramAcceptorprotected java.nio.channels.DatagramChannel open(java.net.SocketAddress localAddress)
throws java.lang.Exception
open in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionprotected boolean isReadable(java.nio.channels.DatagramChannel handle)
isReadable in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>protected boolean isWritable(java.nio.channels.DatagramChannel handle)
isWritable in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>protected java.net.SocketAddress localAddress(java.nio.channels.DatagramChannel handle)
throws java.lang.Exception
localAddress in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionprotected NioSession newSession(IoProcessor<NioSession> processor, java.nio.channels.DatagramChannel handle, java.net.SocketAddress remoteAddress)
newSession in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>protected java.net.SocketAddress receive(java.nio.channels.DatagramChannel handle,
IoBuffer buffer)
throws java.lang.Exception
receive in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionprotected int select()
throws java.lang.Exception
select in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionprotected int select(long timeout)
throws java.lang.Exception
select in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionprotected java.util.Set<java.nio.channels.SelectionKey> selectedHandles()
selectedHandles in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>protected int send(NioSession session, IoBuffer buffer, java.net.SocketAddress remoteAddress) throws java.lang.Exception
send in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionprotected void setInterestedInWrite(NioSession session, boolean isInterested) throws java.lang.Exception
setInterestedInWrite in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionprotected void close(java.nio.channels.DatagramChannel handle)
throws java.lang.Exception
close in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>java.lang.Exceptionprotected void wakeup()
wakeup in class AbstractPollingConnectionlessIoAcceptor<NioSession,java.nio.channels.DatagramChannel>