public final class AprSocketAcceptor extends AbstractPollingIoAcceptor<AprSession,Long>
IoAcceptor
for APR based socket transport (TCP/IP).AbstractIoAcceptor.AcceptorOperationFuture
AbstractIoService.ServiceOperationFuture
backlog, reuseAddress
bindLock
disposalLock, LOGGER, sessionConfig
Constructor and Description |
---|
AprSocketAcceptor()
Constructor for
AprSocketAcceptor using default parameters (multiple thread model). |
AprSocketAcceptor(Executor executor,
IoProcessor<AprSession> processor)
Constructor for
AprSocketAcceptor with a given Executor for handling
connection events and a given AprIoProcessor for handling I/O events, useful for
sharing the same processor and executor over multiple IoService of the same type. |
AprSocketAcceptor(int processorCount)
Constructor for
AprSocketAcceptor using default parameters, and
given number of AprIoProcessor for multithreading I/O operations. |
AprSocketAcceptor(IoProcessor<AprSession> processor)
Constructor for
AprSocketAcceptor with default configuration but a
specific AprIoProcessor , useful for sharing the same processor over multiple
IoService of the same type. |
Modifier and Type | Method and Description |
---|---|
protected AprSession |
accept(IoProcessor<AprSession> processor,
Long handle)
Accept a client connection for a server socket and return a new
IoSession
associated with the given IoProcessor |
protected void |
close(Long handle)
Close a server socket.
|
protected void |
destroy()
Destroy the polling system, will be called when this
IoAcceptor
implementation will be disposed. |
InetSocketAddress |
getDefaultLocalAddress()
Returns the default local address to bind when no argument is specified
in
IoAcceptor.bind() method. |
InetSocketAddress |
getLocalAddress()
Returns the local address which is bound currently.
|
TransportMetadata |
getTransportMetadata() |
protected void |
init()
Initialize the polling system, will be called at construction time.
|
protected void |
init(SelectorProvider selectorProvider)
Initialize the polling system, will be called at construction time.
|
protected SocketAddress |
localAddress(Long handle)
Get the local address associated with a given server socket
|
protected Long |
open(SocketAddress localAddress)
Open a server socket for a given local address.
|
protected int |
select()
Check for acceptable connections, interrupt when at least a server is ready for accepting.
|
protected Iterator<Long> |
selectedHandles()
Iterator for the set of server sockets found with acceptable incoming connections
during the last AbstractPollingIoAcceptor.select() call. |
void |
setDefaultLocalAddress(InetSocketAddress localAddress) |
protected void |
wakeup()
Interrupt the
AbstractPollingIoAcceptor.select() method. |
bindInternal, dispose0, getBacklog, getSessionConfig, isReuseAddress, newSession, setBacklog, setReuseAddress, unbind0
bind, bind, bind, bind, bind, getDefaultLocalAddresses, getLocalAddresses, isCloseOnDeactivation, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, toString, unbind, unbind, unbind, unbind
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, broadcast, dispose, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory
public AprSocketAcceptor()
AprSocketAcceptor
using default parameters (multiple thread model).public AprSocketAcceptor(int processorCount)
AprSocketAcceptor
using default parameters, and
given number of AprIoProcessor
for multithreading I/O operations.processorCount
- the number of processor to create and place in a
SimpleIoProcessorPool
public AprSocketAcceptor(IoProcessor<AprSession> processor)
AprSocketAcceptor
with default configuration but a
specific AprIoProcessor
, useful for sharing the same processor over multiple
IoService
of the same type.processor
- the processor to use for managing I/O eventspublic AprSocketAcceptor(Executor executor, IoProcessor<AprSession> processor)
AprSocketAcceptor
with a given Executor
for handling
connection events and a given AprIoProcessor
for handling I/O events, useful for
sharing the same processor and executor over multiple IoService
of the same type.executor
- the executor for connectionprocessor
- the processor for I/O operationsprotected AprSession accept(IoProcessor<AprSession> processor, Long handle) throws Exception
IoSession
associated with the given IoProcessor
accept
in class AbstractPollingIoAcceptor<AprSession,Long>
processor
- the IoProcessor
to associate with the IoSession
handle
- the server handleIoSession
Exception
- any exception thrown by the underlying systems callsprotected Long open(SocketAddress localAddress) throws Exception
open
in class AbstractPollingIoAcceptor<AprSession,Long>
localAddress
- the associated local addressException
- any exception thrown by the underlying systems callsprotected void init() throws Exception
init
in class AbstractPollingIoAcceptor<AprSession,Long>
Exception
- any exception thrown by the underlying system callsprotected void destroy() throws Exception
IoAcceptor
implementation will be disposed.destroy
in class AbstractPollingIoAcceptor<AprSession,Long>
Exception
- any exception thrown by the underlying systems callsprotected SocketAddress localAddress(Long handle) throws Exception
localAddress
in class AbstractPollingIoAcceptor<AprSession,Long>
handle
- the server socketSocketAddress
associated with this handleException
- any exception thrown by the underlying systems callsprotected int select() throws Exception
AbstractPollingIoAcceptor.selectedHandles()
select
in class AbstractPollingIoAcceptor<AprSession,Long>
Exception
- any exception thrown by the underlying systems callsprotected Iterator<Long> selectedHandles()
Iterator
for the set of server sockets found with acceptable incoming connections
during the last AbstractPollingIoAcceptor.select()
call.selectedHandles
in class AbstractPollingIoAcceptor<AprSession,Long>
protected void close(Long handle) throws Exception
close
in class AbstractPollingIoAcceptor<AprSession,Long>
handle
- the server socketException
- any exception thrown by the underlying systems callsprotected void wakeup()
AbstractPollingIoAcceptor.select()
method. Used when the poll set need to be modified.wakeup
in class AbstractPollingIoAcceptor<AprSession,Long>
public InetSocketAddress getLocalAddress()
getLocalAddress
in interface IoAcceptor
getLocalAddress
in class AbstractIoAcceptor
public InetSocketAddress getDefaultLocalAddress()
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)
.getDefaultLocalAddress
in interface IoAcceptor
getDefaultLocalAddress
in class AbstractIoAcceptor
public void setDefaultLocalAddress(InetSocketAddress localAddress)
localAddress
- The localAddress to setAbstractIoAcceptor.setDefaultLocalAddress(SocketAddress)
public TransportMetadata getTransportMetadata()
TransportMetadata
that this service runs on.protected void init(SelectorProvider selectorProvider) throws Exception
AbstractPollingIoAcceptor
init
in class AbstractPollingIoAcceptor<AprSession,Long>
selectorProvider
- The Selector Provider that will be used by this polling acceptorException
- any exception thrown by the underlying system callsCopyright © 2004–2021 Apache MINA Project. All rights reserved.