public class IoProtocolAcceptor extends java.lang.Object implements ProtocolAcceptor
ProtocolAcceptor
which wraps IoAcceptor
to provide
low-level I/O.
Please note that the user-defined attributes of ProtocolSession
and its wrapping IoSession
are shared.
Constructor and Description |
---|
IoProtocolAcceptor(IoAcceptor acceptor)
Creates a new instance with the specified
IoAcceptor . |
Modifier and Type | Method and Description |
---|---|
void |
bind(java.net.SocketAddress address,
ProtocolProvider provider)
Binds to the specified
address and handles incoming
connections with the specified protocolProvider . |
ExceptionMonitor |
getExceptionMonitor()
Returns the current exception monitor.
|
ProtocolFilterChain |
getFilterChain()
Returns the filter chain that filters all events which is related
with sessions this manager manages.
|
IoAcceptor |
getIoAcceptor()
Returns the underlying
IoAcceptor instance this acceptor is
wrapping. |
ProtocolSession |
newSession(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
(Optional) Returns a
ProtocolSession that is bound to the specified
localAddress and remoteAddress which reuses
the localAddress that is already bound by ProtocolAcceptor
via ProtocolAcceptor.bind(SocketAddress, ProtocolProvider) . |
void |
setExceptionMonitor(ExceptionMonitor monitor)
Sets the uncaught exception monitor.
|
void |
unbind(java.net.SocketAddress address)
Unbinds from the specified
address . |
public IoProtocolAcceptor(IoAcceptor acceptor)
IoAcceptor
.public IoAcceptor getIoAcceptor()
IoAcceptor
instance this acceptor is
wrapping.public void bind(java.net.SocketAddress address, ProtocolProvider provider) throws java.io.IOException
ProtocolAcceptor
address
and handles incoming
connections with the specified protocolProvider
.bind
in interface ProtocolAcceptor
java.io.IOException
- if failed to bindpublic void unbind(java.net.SocketAddress address)
ProtocolAcceptor
address
.unbind
in interface ProtocolAcceptor
public ProtocolSession newSession(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
ProtocolAcceptor
ProtocolSession
that is bound to the specified
localAddress and remoteAddress which reuses
the localAddress that is already bound by ProtocolAcceptor
via ProtocolAcceptor.bind(SocketAddress, ProtocolProvider)
.
This operation is optional. Please throw UnsupportedOperationException
if the transport type doesn't support this operation. This operation is
usually implemented for connectionless transport types.
newSession
in interface ProtocolAcceptor
public ProtocolFilterChain getFilterChain()
ProtocolSessionManager
getFilterChain
in interface ProtocolSessionManager
public ExceptionMonitor getExceptionMonitor()
SessionManager
getExceptionMonitor
in interface SessionManager
public void setExceptionMonitor(ExceptionMonitor monitor)
SessionManager
null
is specified,
a new instance of DefaultExceptionMonitor
will be set.setExceptionMonitor
in interface SessionManager
monitor
- A new instance of DefaultExceptionMonitor
is set
if null is specified.