public final class AprSocketAcceptor extends AbstractPollingIoAcceptor<AprSession,java.lang.Long> implements SocketAcceptor
IoAcceptor for APR based socket transport (TCP/IP).AbstractIoAcceptor.AcceptorOperationFutureAbstractIoService.ServiceOperationFuturebacklog, reuseAddressbindLockdisposalLock| Constructor and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
SocketSessionConfig |
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()
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, isReuseAddress, newSession, setBacklog, setReuseAddress, unbind0bind, 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, waitgetBacklog, isReuseAddress, setBacklog, setReuseAddressbind, 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, setSessionDataStructureFactorypublic 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
SimpleIoProcessorPoolpublic 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 IoProcessoraccept in class AbstractPollingIoAcceptor<AprSession,java.lang.Long>processor - the IoProcessor to associate with the IoSessionhandle - the server handleIoSessionjava.lang.Exception - any exception thrown by the underlying systems callsprotected java.lang.Long open(java.net.SocketAddress localAddress)
throws java.lang.Exception
open in class 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 in class 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 in class 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 in class 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 in class 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 in class AbstractPollingIoAcceptor<AprSession,java.lang.Long>protected void close(java.lang.Long handle)
throws java.lang.Exception
close in class 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 in class AbstractPollingIoAcceptor<AprSession,java.lang.Long>public java.net.InetSocketAddress getLocalAddress()
getLocalAddress in interface IoAcceptorgetLocalAddress in interface SocketAcceptorgetLocalAddress in class AbstractIoAcceptorpublic 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 in interface IoAcceptorgetDefaultLocalAddress in interface SocketAcceptorgetDefaultLocalAddress in class AbstractIoAcceptorpublic void setDefaultLocalAddress(java.net.InetSocketAddress localAddress)
setDefaultLocalAddress in interface SocketAcceptorpublic TransportMetadata getTransportMetadata()
TransportMetadata that this service runs on.getTransportMetadata in interface IoServicepublic SocketSessionConfig getSessionConfig()
IoSessions
created by this service.getSessionConfig in interface IoServicegetSessionConfig in interface SocketAcceptorgetSessionConfig in class AbstractIoService