public final class AprSocketAcceptor extends AbstractPollingIoAcceptor<AprSession,java.lang.Long>
IoAcceptor
for APR based socket transport (TCP/IP).AbstractIoAcceptor.AcceptorOperationFuture
AbstractIoService.ServiceOperationFuture
backlog, reuseAddress
bindLock
disposalLock, sessionConfig
构造器和说明 |
---|
AprSocketAcceptor()
Constructor for
AprSocketAcceptor using default parameters (multiple thread model). |
AprSocketAcceptor(java.util.concurrent.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. |
限定符和类型 | 方法和说明 |
---|---|
protected AprSession |
accept(IoProcessor<AprSession> processor,
java.lang.Long handle)
Accept a client connection for a server socket and return a new
IoSession
associated with the given IoProcessor |
protected void |
close(java.lang.Long handle)
Close a server socket.
|
protected void |
destroy()
Destroy the polling system, will be called when this
IoAcceptor
implementation will be disposed. |
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.
|
TransportMetadata |
getTransportMetadata() |
protected void |
init()
Initialize the polling system, will be called at construction time.
|
protected void |
init(java.nio.channels.spi.SelectorProvider selectorProvider)
Initialize the polling system, will be called at construction time.
|
protected java.net.SocketAddress |
localAddress(java.lang.Long handle)
Get the local address associated with a given server socket
|
protected java.lang.Long |
open(java.net.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 java.util.Iterator<java.lang.Long> |
selectedHandles()
Iterator for the set of server sockets found with acceptable incoming connections
during the last AbstractPollingIoAcceptor.select() call. |
void |
setDefaultLocalAddress(java.net.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(java.util.concurrent.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, java.lang.Long handle) throws java.lang.Exception
IoSession
associated with the given IoProcessor
accept
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
processor
- the IoProcessor
to associate with the IoSession
handle
- the server handleIoSession
java.lang.Exception
- any exception thrown by the underlying systems callsprotected java.lang.Long open(java.net.SocketAddress localAddress) throws java.lang.Exception
open
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
localAddress
- the associated local addressjava.lang.Exception
- any exception thrown by the underlying systems callsprotected void init() throws java.lang.Exception
init
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
java.lang.Exception
- any exception thrown by the underlying system callsprotected void destroy() throws java.lang.Exception
IoAcceptor
implementation will be disposed.destroy
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
java.lang.Exception
- any exception thrown by the underlying systems callsprotected java.net.SocketAddress localAddress(java.lang.Long handle) throws java.lang.Exception
localAddress
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
handle
- the server socketSocketAddress
associated with this handlejava.lang.Exception
- any exception thrown by the underlying systems callsprotected int select() throws java.lang.Exception
AbstractPollingIoAcceptor.selectedHandles()
select
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
java.lang.Exception
- any exception thrown by the underlying systems callsprotected java.util.Iterator<java.lang.Long> selectedHandles()
Iterator
for the set of server sockets found with acceptable incoming connections
during the last AbstractPollingIoAcceptor.select()
call.selectedHandles
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
protected void close(java.lang.Long handle) throws java.lang.Exception
close
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
handle
- the server socketjava.lang.Exception
- any exception thrown by the underlying systems callsprotected void wakeup()
AbstractPollingIoAcceptor.select()
method. Used when the poll set need to be modified.wakeup
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
public java.net.InetSocketAddress getLocalAddress()
getLocalAddress
在接口中 IoAcceptor
getLocalAddress
在类中 AbstractIoAcceptor
public java.net.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
在接口中 IoAcceptor
getDefaultLocalAddress
在类中 AbstractIoAcceptor
public void setDefaultLocalAddress(java.net.InetSocketAddress localAddress)
localAddress
- The localAddress to setAbstractIoAcceptor.setDefaultLocalAddress(SocketAddress)
public TransportMetadata getTransportMetadata()
TransportMetadata
that this service runs on.protected void init(java.nio.channels.spi.SelectorProvider selectorProvider) throws java.lang.Exception
AbstractPollingIoAcceptor
init
在类中 AbstractPollingIoAcceptor<AprSession,java.lang.Long>
selectorProvider
- The Selector Provider that will be used by this polling acceptorjava.lang.Exception
- any exception thrown by the underlying system calls