public final class AprSocketAcceptor extends AbstractPollingIoAcceptor<AprSession,java.lang.Long> implements SocketAcceptor
AbstractIoAcceptor.AcceptorOperationFuture
AbstractIoService.ServiceOperationFuture
bindLock
disposalLock
Constructor and Description |
---|
AprSocketAcceptor() |
AprSocketAcceptor(java.util.concurrent.Executor executor,
IoProcessor<AprSession> processor) |
AprSocketAcceptor(int processorCount) |
AprSocketAcceptor(IoProcessor<AprSession> processor) |
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. |
int |
getBacklog()
Returns the size of the backlog.
|
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
IoSession s
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.
|
boolean |
isReuseAddress() |
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 boolean |
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 |
setBacklog(int backlog)
Sets the size of the backlog.
|
void |
setDefaultLocalAddress(java.net.InetSocketAddress localAddress) |
void |
setReuseAddress(boolean reuseAddress) |
protected void |
wakeup()
Interrupt the
AbstractPollingIoAcceptor.select() method. |
bind0, dispose0, newSession, unbind0
bind, bind, bind, bind, getDefaultLocalAddresses, getLocalAddresses, isCloseOnDeactivation, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, toString, unbind, unbind, unbind, unbind
addListener, broadcast, dispose, executeWorker, executeWorker, finishSessionInitialization, finishSessionInitialization0, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getIdleState, getIdleStatusChecker, getListeners, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, isActive, isDisposed, isDisposing, notifyIdleness, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
bind, bind, bind, bind, getDefaultLocalAddresses, getLocalAddresses, isCloseOnDeactivation, newSession, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, unbind, unbind, unbind, unbind
addListener, broadcast, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getIdleState, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory
public AprSocketAcceptor()
public AprSocketAcceptor(int processorCount)
public AprSocketAcceptor(IoProcessor<AprSession> processor)
public AprSocketAcceptor(java.util.concurrent.Executor executor, IoProcessor<AprSession> processor)
protected AprSession accept(IoProcessor<AprSession> processor, java.lang.Long handle) throws java.lang.Exception
AbstractPollingIoAcceptor
IoSession
associated with the given IoProcessor
accept
in class 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
AbstractPollingIoAcceptor
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
AbstractPollingIoAcceptor
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
AbstractPollingIoAcceptor
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
AbstractPollingIoAcceptor
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 boolean select() throws java.lang.Exception
AbstractPollingIoAcceptor
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()
AbstractPollingIoAcceptor
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
AbstractPollingIoAcceptor
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
AbstractPollingIoAcceptor.select()
method. Used when the poll set need to be modified.wakeup
in class AbstractPollingIoAcceptor<AprSession,java.lang.Long>
public int getBacklog()
SocketAcceptor
getBacklog
in interface SocketAcceptor
public boolean isReuseAddress()
isReuseAddress
in interface SocketAcceptor
ServerSocket.getReuseAddress()
public void setBacklog(int backlog)
SocketAcceptor
setBacklog
in interface SocketAcceptor
public java.net.InetSocketAddress getLocalAddress()
AbstractIoAcceptor
getLocalAddress
in interface IoAcceptor
getLocalAddress
in interface SocketAcceptor
getLocalAddress
in class AbstractIoAcceptor
public java.net.InetSocketAddress getDefaultLocalAddress()
AbstractIoAcceptor
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 interface SocketAcceptor
getDefaultLocalAddress
in class AbstractIoAcceptor
public void setDefaultLocalAddress(java.net.InetSocketAddress localAddress)
setDefaultLocalAddress
in interface SocketAcceptor
public void setReuseAddress(boolean reuseAddress)
setReuseAddress
in interface SocketAcceptor
ServerSocket.setReuseAddress(boolean)
public TransportMetadata getTransportMetadata()
IoService
TransportMetadata
that this service runs on.getTransportMetadata
in interface IoService
public SocketSessionConfig getSessionConfig()
AbstractIoService
IoSession
s
created by this service.getSessionConfig
in interface IoService
getSessionConfig
in interface SocketAcceptor
getSessionConfig
in class AbstractIoService
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.