public final class NioSocketAcceptor extends AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel> implements SocketAcceptor
IoAcceptor
for socket transport (TCP/IP). This class
handles incoming TCP/IP based socket connections.AbstractIoAcceptor.AcceptorOperationFuture
AbstractIoService.ServiceOperationFuture
bindLock
Constructor and Description |
---|
NioSocketAcceptor()
Create an acceptor with a single processing thread using a NewThreadExecutor
|
NioSocketAcceptor(java.util.concurrent.Executor executor,
IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor) |
NioSocketAcceptor(int processorCount) |
NioSocketAcceptor(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor) |
Modifier and Type | Method and Description |
---|---|
protected org.apache.mina.transport.socket.nio.NioSession |
accept(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor,
java.nio.channels.ServerSocketChannel handle) |
protected void |
close(java.nio.channels.ServerSocketChannel handle) |
protected void |
destroy() |
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() |
boolean |
isReuseAddress() |
protected java.net.SocketAddress |
localAddress(java.nio.channels.ServerSocketChannel handle) |
protected java.nio.channels.ServerSocketChannel |
open(java.net.SocketAddress localAddress) |
protected boolean |
select() |
protected java.util.Iterator<java.nio.channels.ServerSocketChannel> |
selectedHandles() |
void |
setBacklog(int backlog)
Sets the size of the backlog.
|
void |
setDefaultLocalAddress(java.net.InetSocketAddress localAddress) |
void |
setReuseAddress(boolean reuseAddress) |
protected void |
wakeup() |
bind0, dispose0, newSession, unbind0
bind, bind, bind, bind, getDefaultLocalAddresses, getLocalAddresses, isCloseOnDeactivation, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, toString, unbind, unbind, unbind, unbind
addListener, broadcast, decreaseScheduledWriteMessages, dispose, finishSessionInitialization, finishSessionInitialization0, getActivationTime, getBothIdleCount, getBothIdleTime, getBothIdleTimeInMillis, getCumulativeManagedSessionCount, getFilterChain, getFilterChainBuilder, getHandler, getIdleCount, getIdleTime, getIdleTimeInMillis, getLargestManagedSessionCount, getLargestReadBytesThroughput, getLargestReadMessagesThroughput, getLargestWrittenBytesThroughput, getLargestWrittenMessagesThroughput, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getListeners, getManagedSessionCount, getManagedSessions, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReaderIdleTime, getReaderIdleTimeInMillis, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleCount, getWriterIdleTime, getWriterIdleTimeInMillis, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, increaseReadBytes, increaseReadMessages, increaseScheduledWriteBytes, increaseScheduledWriteMessages, increaseWrittenBytes, increaseWrittenMessages, isActive, isBothIdle, isDisposed, isDisposing, isIdle, isReaderIdle, isWriterIdle, notifyIdleness, removeListener, setBothIdleTime, setFilterChainBuilder, setHandler, setIdleTime, setLastReadTime, setLastWriteTime, setReaderIdleTime, setSessionDataStructureFactory, setThroughputCalculationInterval, setWriterIdleTime
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, getBothIdleCount, getBothIdleTime, getBothIdleTimeInMillis, getCumulativeManagedSessionCount, getFilterChain, getFilterChainBuilder, getHandler, getIdleCount, getIdleTime, getIdleTimeInMillis, getLargestManagedSessionCount, getLargestReadBytesThroughput, getLargestReadMessagesThroughput, getLargestWrittenBytesThroughput, getLargestWrittenMessagesThroughput, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getManagedSessionCount, getManagedSessions, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReaderIdleTime, getReaderIdleTimeInMillis, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleCount, getWriterIdleTime, getWriterIdleTimeInMillis, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, isActive, isBothIdle, isDisposed, isDisposing, isIdle, isReaderIdle, isWriterIdle, removeListener, setBothIdleTime, setFilterChainBuilder, setHandler, setIdleTime, setReaderIdleTime, setSessionDataStructureFactory, setThroughputCalculationInterval, setWriterIdleTime
public NioSocketAcceptor()
public NioSocketAcceptor(int processorCount)
public NioSocketAcceptor(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor)
public NioSocketAcceptor(java.util.concurrent.Executor executor, IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor)
protected void init() throws java.lang.Exception
init
in class AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel>
java.lang.Exception
protected void destroy() throws java.lang.Exception
destroy
in class AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel>
java.lang.Exception
public TransportMetadata getTransportMetadata()
IoService
TransportMetadata
that this service runs on.getTransportMetadata
in interface IoService
public SocketSessionConfig getSessionConfig()
IoService
IoSession
s
created by this service.getSessionConfig
in interface IoService
getSessionConfig
in interface SocketService
getSessionConfig
in class AbstractIoService
public java.net.InetSocketAddress getLocalAddress()
IoAcceptor
getLocalAddress
in interface IoAcceptor
getLocalAddress
in interface SocketAcceptor
getLocalAddress
in class AbstractIoAcceptor
public java.net.InetSocketAddress getDefaultLocalAddress()
IoAcceptor
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 boolean isReuseAddress()
isReuseAddress
in interface SocketAcceptor
ServerSocket.getReuseAddress()
public void setReuseAddress(boolean reuseAddress)
setReuseAddress
in interface SocketAcceptor
ServerSocket.setReuseAddress(boolean)
public int getBacklog()
SocketAcceptor
getBacklog
in interface SocketAcceptor
public void setBacklog(int backlog)
SocketAcceptor
setBacklog
in interface SocketAcceptor
protected org.apache.mina.transport.socket.nio.NioSession accept(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor, java.nio.channels.ServerSocketChannel handle) throws java.lang.Exception
accept
in class AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel>
java.lang.Exception
protected java.nio.channels.ServerSocketChannel open(java.net.SocketAddress localAddress) throws java.lang.Exception
open
in class AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel>
java.lang.Exception
protected java.net.SocketAddress localAddress(java.nio.channels.ServerSocketChannel handle) throws java.lang.Exception
localAddress
in class AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel>
java.lang.Exception
protected boolean select() throws java.lang.Exception
select
in class AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel>
java.lang.Exception
protected java.util.Iterator<java.nio.channels.ServerSocketChannel> selectedHandles()
selectedHandles
in class AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel>
protected void close(java.nio.channels.ServerSocketChannel handle) throws java.lang.Exception
close
in class AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel>
java.lang.Exception
protected void wakeup()
wakeup
in class AbstractPollingIoAcceptor<org.apache.mina.transport.socket.nio.NioSession,java.nio.channels.ServerSocketChannel>
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.