org.apache.mina.core.polling
Class AbstractPollingConnectionlessIoAcceptor<S extends AbstractIoSession,H>
java.lang.Object
org.apache.mina.core.service.AbstractIoService
org.apache.mina.core.service.AbstractIoAcceptor
org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor<S,H>
- Type Parameters:
S
- the type of the IoSession
this processor can handle
- All Implemented Interfaces:
- IoAcceptor, IoService
- Direct Known Subclasses:
- NioDatagramAcceptor
public abstract class AbstractPollingConnectionlessIoAcceptor<S extends AbstractIoSession,H>
- extends AbstractIoAcceptor
IoAcceptor
for datagram transport (UDP/IP).
- Author:
- Apache MINA Project
Method Summary |
protected java.util.Set<java.net.SocketAddress> |
bindInternal(java.util.List<? extends java.net.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. |
IoSessionRecycler |
getSessionRecycler()
|
protected abstract void |
init()
|
protected abstract boolean |
isReadable(H handle)
|
protected abstract boolean |
isWritable(H handle)
|
protected abstract java.net.SocketAddress |
localAddress(H handle)
|
protected abstract S |
newSession(IoProcessor<S> processor,
H handle,
java.net.SocketAddress remoteAddress)
|
IoSession |
newSession(java.net.SocketAddress remoteAddress,
java.net.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(java.net.SocketAddress localAddress)
|
protected abstract java.net.SocketAddress |
receive(H handle,
IoBuffer buffer)
|
protected abstract int |
select()
|
protected abstract int |
select(long timeout)
|
protected abstract java.util.Iterator<H> |
selectedHandles()
|
protected abstract int |
send(S session,
IoBuffer buffer,
java.net.SocketAddress remoteAddress)
|
protected abstract void |
setInterestedInWrite(S session,
boolean interested)
|
void |
setSessionRecycler(IoSessionRecycler sessionRecycler)
|
protected void |
unbind0(java.util.List<? extends java.net.SocketAddress> localAddresses)
Implement this method to perform the actual unbind operation. |
protected abstract void |
wakeup()
|
Methods inherited from class org.apache.mina.core.service.AbstractIoAcceptor |
bind, bind, bind, bind, getDefaultLocalAddress, getDefaultLocalAddresses, getLocalAddress, 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, getSessionConfig, 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.IoService |
addListener, broadcast, dispose, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionConfig, getSessionDataStructureFactory, getStatistics, getTransportMetadata, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory |
AbstractPollingConnectionlessIoAcceptor
protected AbstractPollingConnectionlessIoAcceptor(IoSessionConfig sessionConfig)
- Creates a new instance.
AbstractPollingConnectionlessIoAcceptor
protected AbstractPollingConnectionlessIoAcceptor(IoSessionConfig sessionConfig,
java.util.concurrent.Executor executor)
- Creates a new instance.
init
protected abstract void init()
throws java.lang.Exception
- Throws:
java.lang.Exception
destroy
protected abstract void destroy()
throws java.lang.Exception
- Throws:
java.lang.Exception
select
protected abstract int select()
throws java.lang.Exception
- Throws:
java.lang.Exception
select
protected abstract int select(long timeout)
throws java.lang.Exception
- Throws:
java.lang.Exception
wakeup
protected abstract void wakeup()
selectedHandles
protected abstract java.util.Iterator<H> selectedHandles()
open
protected abstract H open(java.net.SocketAddress localAddress)
throws java.lang.Exception
- Throws:
java.lang.Exception
close
protected abstract void close(H handle)
throws java.lang.Exception
- Throws:
java.lang.Exception
localAddress
protected abstract java.net.SocketAddress localAddress(H handle)
throws java.lang.Exception
- Throws:
java.lang.Exception
isReadable
protected abstract boolean isReadable(H handle)
isWritable
protected abstract boolean isWritable(H handle)
receive
protected abstract java.net.SocketAddress receive(H handle,
IoBuffer buffer)
throws java.lang.Exception
- Throws:
java.lang.Exception
send
protected abstract int send(S session,
IoBuffer buffer,
java.net.SocketAddress remoteAddress)
throws java.lang.Exception
- Throws:
java.lang.Exception
newSession
protected abstract S newSession(IoProcessor<S> processor,
H handle,
java.net.SocketAddress remoteAddress)
throws java.lang.Exception
- Throws:
java.lang.Exception
setInterestedInWrite
protected abstract void setInterestedInWrite(S session,
boolean interested)
throws java.lang.Exception
- Throws:
java.lang.Exception
dispose0
protected void dispose0()
throws java.lang.Exception
- Implement this method to release any acquired resources. This method
is invoked only once by
AbstractIoService.dispose()
.
- Specified by:
dispose0
in class AbstractIoService
- Throws:
java.lang.Exception
bindInternal
protected final java.util.Set<java.net.SocketAddress> bindInternal(java.util.List<? extends java.net.SocketAddress> localAddresses)
throws java.lang.Exception
- Starts the acceptor, and register the given addresses
- Specified by:
bindInternal
in class AbstractIoAcceptor
- Returns:
- the
Set
of the local addresses which is bound actually
- Throws:
java.lang.Exception
unbind0
protected final void unbind0(java.util.List<? extends java.net.SocketAddress> localAddresses)
throws java.lang.Exception
- Implement this method to perform the actual unbind operation.
- Specified by:
unbind0
in class AbstractIoAcceptor
- Throws:
java.lang.Exception
newSession
public final IoSession newSession(java.net.SocketAddress remoteAddress,
java.net.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.
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.
getSessionRecycler
public final IoSessionRecycler getSessionRecycler()
setSessionRecycler
public final void setSessionRecycler(IoSessionRecycler sessionRecycler)
Copyright © 2004-2011 Apache MINA Project. All Rights Reserved.