S - the type of the IoSession this processor can handlepublic abstract class AbstractPollingConnectionlessIoAcceptor<S extends AbstractIoSession,H> extends AbstractIoAcceptor implements IoProcessor<S>
IoAcceptor for datagram transport (UDP/IP).AbstractIoAcceptor.AcceptorOperationFutureAbstractIoService.ServiceOperationFuturebindLockdisposalLock| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPollingConnectionlessIoAcceptor(IoSessionConfig sessionConfig)
Creates a new instance.
|
protected |
AbstractPollingConnectionlessIoAcceptor(IoSessionConfig sessionConfig,
Executor executor)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(S session)
Adds the specified
session to the I/O processor so that
the I/O processor starts to perform any I/O operations related
with the session. |
protected Set<SocketAddress> |
bindInternal(List<? extends SocketAddress> localAddresses)
Starts the acceptor, and register the given addresses
|
protected abstract void |
close(H handle) |
protected abstract void |
destroy() |
protected void |
dispose0()
Implement this method to release any acquired resources.
|
void |
flush(S session)
Flushes the internal write request queue of the specified
session. |
IoSessionRecycler |
getSessionRecycler() |
protected abstract void |
init() |
protected abstract boolean |
isReadable(H handle) |
protected abstract boolean |
isWritable(H handle) |
protected abstract SocketAddress |
localAddress(H handle) |
protected abstract S |
newSession(IoProcessor<S> processor,
H handle,
SocketAddress remoteAddress) |
IoSession |
newSession(SocketAddress remoteAddress,
SocketAddress localAddress)
(Optional) Returns an
IoSession that is bound to the specified
localAddress and the specified remoteAddress which
reuses the local address that is already bound by this service. |
protected abstract H |
open(SocketAddress localAddress) |
protected abstract SocketAddress |
receive(H handle,
IoBuffer buffer) |
void |
remove(S session)
Removes and closes the specified
session from the I/O
processor so that the I/O processor closes the connection
associated with the session and releases any other related
resources. |
protected abstract int |
select() |
protected abstract int |
select(long timeout) |
protected abstract Set<SelectionKey> |
selectedHandles() |
protected abstract int |
send(S session,
IoBuffer buffer,
SocketAddress remoteAddress) |
protected abstract void |
setInterestedInWrite(S session,
boolean interested) |
void |
setSessionRecycler(IoSessionRecycler sessionRecycler) |
protected void |
unbind0(List<? extends SocketAddress> localAddresses)
Implement this method to perform the actual unbind operation.
|
void |
updateTrafficControl(S session)
Controls the traffic of the specified
session depending of the
IoSession.isReadSuspended() and IoSession.isWriteSuspended()
flags |
protected abstract void |
wakeup() |
void |
write(S session,
WriteRequest writeRequest)
Writes the WriteRequest for the specified
session. |
bind, bind, bind, bind, bind, getDefaultLocalAddress, getDefaultLocalAddresses, getLocalAddress, 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, getSessionConfig, getSessionDataStructureFactory, getStatistics, initSession, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactoryclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdispose, isDisposed, isDisposingaddListener, broadcast, dispose, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionConfig, getSessionDataStructureFactory, getStatistics, getTransportMetadata, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactoryprotected AbstractPollingConnectionlessIoAcceptor(IoSessionConfig sessionConfig)
protected AbstractPollingConnectionlessIoAcceptor(IoSessionConfig sessionConfig, Executor executor)
protected abstract void wakeup()
protected abstract Set<SelectionKey> selectedHandles()
protected abstract H open(SocketAddress localAddress) throws Exception
Exceptionprotected abstract SocketAddress localAddress(H handle) throws Exception
Exceptionprotected abstract boolean isReadable(H handle)
protected abstract boolean isWritable(H handle)
protected abstract SocketAddress receive(H handle, IoBuffer buffer) throws Exception
Exceptionprotected abstract int send(S session, IoBuffer buffer, SocketAddress remoteAddress) throws Exception
Exceptionprotected abstract S newSession(IoProcessor<S> processor, H handle, SocketAddress remoteAddress) throws Exception
Exceptionprotected abstract void setInterestedInWrite(S session, boolean interested) throws Exception
Exceptionprotected void dispose0()
throws Exception
AbstractIoService.dispose().dispose0 in class AbstractIoServiceExceptionprotected final Set<SocketAddress> bindInternal(List<? extends SocketAddress> localAddresses) throws Exception
bindInternal in class AbstractIoAcceptorSet of the local addresses which is bound actuallyExceptionprotected final void unbind0(List<? extends SocketAddress> localAddresses) throws Exception
unbind0 in class AbstractIoAcceptorExceptionpublic final IoSession newSession(SocketAddress remoteAddress, SocketAddress localAddress)
IoSession that is bound to the specified
localAddress and the specified remoteAddress which
reuses the local address that is already bound by this service.
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.
newSession in interface IoAcceptorpublic final IoSessionRecycler getSessionRecycler()
public final void setSessionRecycler(IoSessionRecycler sessionRecycler)
public void add(S session)
session to the I/O processor so that
the I/O processor starts to perform any I/O operations related
with the session.add in interface IoProcessor<S extends AbstractIoSession>session - The added sessionpublic void flush(S session)
session.flush in interface IoProcessor<S extends AbstractIoSession>session - The session we want the message to be writtenpublic void write(S session, WriteRequest writeRequest)
session.write in interface IoProcessor<S extends AbstractIoSession>session - The session we want the message to be writtenwriteRequest - the WriteRequest to writepublic void remove(S session)
session from the I/O
processor so that the I/O processor closes the connection
associated with the session and releases any other related
resources.remove in interface IoProcessor<S extends AbstractIoSession>public void updateTrafficControl(S session)
session depending of the
IoSession.isReadSuspended() and IoSession.isWriteSuspended()
flagsupdateTrafficControl in interface IoProcessor<S extends AbstractIoSession>