public class Nio2Acceptor extends Nio2Service implements IoAcceptor
Modifier and Type | Class and Description |
---|---|
protected class |
Nio2Acceptor.AcceptCompletionHandler |
AbstractCloseable.State
Modifier and Type | Field and Description |
---|---|
protected Map<SocketAddress,AsynchronousServerSocketChannel> |
channels |
CONFIGURABLE_OPTIONS, disposing, sessions
closeFuture, lock, state
log
DEFAULT_BACKLOG
DEFAULT_REUSE_ADDRESS
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
Constructor and Description |
---|
Nio2Acceptor(FactoryManager manager,
IoHandler handler,
AsynchronousChannelGroup group) |
Modifier and Type | Method and Description |
---|---|
void |
bind(Collection<? extends SocketAddress> addresses) |
void |
bind(SocketAddress address) |
CloseFuture |
close(boolean immediately)
Close this resource asynchronously and return a future.
|
protected CompletionHandler<AsynchronousSocketChannel,? super SocketAddress> |
createSocketCompletionHandler(Map<SocketAddress,AsynchronousServerSocketChannel> channelsMap,
AsynchronousServerSocketChannel socket) |
void |
doCloseImmediately()
doCloseImmediately is called once and only once
with state == Immediate
|
Set<SocketAddress> |
getBoundAddresses() |
protected AsynchronousServerSocketChannel |
openAsynchronousServerSocketChannel(SocketAddress address,
AsynchronousChannelGroup group) |
String |
toString() |
void |
unbind() |
void |
unbind(Collection<? extends SocketAddress> addresses) |
void |
unbind(SocketAddress address) |
dispose, getChannelGroup, getFactoryManager, getInnerCloseable, getIoHandler, getManagedSessions, sessionClosed, setOption, setSocketOptions, unmapSession
doCloseGracefully
addCloseFutureListener, builder, isClosed, isClosing, preClose, removeCloseFutureListener
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getManagedSessions
addCloseFutureListener, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListener
protected final Map<SocketAddress,AsynchronousServerSocketChannel> channels
public Nio2Acceptor(FactoryManager manager, IoHandler handler, AsynchronousChannelGroup group)
public void bind(Collection<? extends SocketAddress> addresses) throws IOException
bind
in interface IoAcceptor
IOException
protected AsynchronousServerSocketChannel openAsynchronousServerSocketChannel(SocketAddress address, AsynchronousChannelGroup group) throws IOException
IOException
protected CompletionHandler<AsynchronousSocketChannel,? super SocketAddress> createSocketCompletionHandler(Map<SocketAddress,AsynchronousServerSocketChannel> channelsMap, AsynchronousServerSocketChannel socket) throws IOException
IOException
public void bind(SocketAddress address) throws IOException
bind
in interface IoAcceptor
IOException
public void unbind()
unbind
in interface IoAcceptor
public void unbind(Collection<? extends SocketAddress> addresses)
unbind
in interface IoAcceptor
public void unbind(SocketAddress address)
unbind
in interface IoAcceptor
public Set<SocketAddress> getBoundAddresses()
getBoundAddresses
in interface IoAcceptor
public CloseFuture close(boolean immediately)
Closeable
close
in class AbstractCloseable
immediately
- true
if the resource should be shut down abruptly,
false
for a graceful closeCloseFuture
representing the close requestpublic void doCloseImmediately()
AbstractCloseable
doCloseImmediately is called once and only once with state == Immediate
Overriding methods should always call the base implementation. It may be called concurrently while preClose() or doCloseGracefully is executing
doCloseImmediately
in class AbstractInnerCloseable
Copyright © 2008–2019 The Apache Software Foundation. All rights reserved.