public interface IoService
限定符和类型 | 方法和说明 |
---|---|
void |
addListener(IoServiceListener listener)
Adds an
IoServiceListener that listens any events related with
this service. |
IoServiceConfig |
getDefaultConfig()
Returns the default configuration which is used when you didn't specify
any configuration.
|
DefaultIoFilterChainBuilder |
getFilterChain()
A shortcut for ( ( DefaultIoFilterChainBuilder )
getFilterChainBuilder() ). |
IoFilterChainBuilder |
getFilterChainBuilder()
Returns the global
IoFilterChainBuilder which will modify the
IoFilterChain of all IoSession s which is managed
by this service. |
java.util.Set<java.net.SocketAddress> |
getManagedServiceAddresses()
Returns all
SocketAddress es this service is managing. |
java.util.Set<IoSession> |
getManagedSessions(java.net.SocketAddress serviceAddress)
Returns all sessions with the specified remote or local address,
which are currently managed by this service.
|
boolean |
isManaged(java.net.SocketAddress serviceAddress)
Returns true if this service is managing the specified serviceAddress.
|
void |
removeListener(IoServiceListener listener)
Removed an existing
IoServiceListener that listens any events
related with this service. |
void |
setFilterChainBuilder(IoFilterChainBuilder builder)
Sets the global
IoFilterChainBuilder which will modify the
IoFilterChain of all IoSession s which is managed
by this service. |
void addListener(IoServiceListener listener)
IoServiceListener
that listens any events related with
this service.void removeListener(IoServiceListener listener)
IoServiceListener
that listens any events
related with this service.java.util.Set<java.net.SocketAddress> getManagedServiceAddresses()
SocketAddress
es this service is managing.
If this service is an IoAcceptor
, a set of bind addresses will
be returned. If this service is an IoConnector
, a set of remote
addresses will be returned.boolean isManaged(java.net.SocketAddress serviceAddress)
IoAcceptor
, serviceAddress is a bind address.
If this service is an IoConnector
, serviceAddress is a remote address.java.util.Set<IoSession> getManagedSessions(java.net.SocketAddress serviceAddress)
IoAcceptor
will assume the specified address is a local
address, and IoConnector
will assume it's a remote address.serviceAddress
- the address to return all sessions for.java.lang.IllegalArgumentException
- if the specified address has
not been bound.java.lang.UnsupportedOperationException
- if this operation isn't supported
for the particular transport type implemented by this IoService
.IoServiceConfig getDefaultConfig()
IoFilterChainBuilder getFilterChainBuilder()
IoFilterChainBuilder
which will modify the
IoFilterChain
of all IoSession
s which is managed
by this service.
The default value is an empty DefaultIoFilterChainBuilder
.void setFilterChainBuilder(IoFilterChainBuilder builder)
IoFilterChainBuilder
which will modify the
IoFilterChain
of all IoSession
s which is managed
by this service.
If you specify null this property will be set to
an empty DefaultIoFilterChainBuilder
.DefaultIoFilterChainBuilder getFilterChain()
getFilterChainBuilder()
).
Please note that the returned object is not a real IoFilterChain
but a DefaultIoFilterChainBuilder
. Modifying the returned builder
won't affect the existing IoSession
s at all, because
IoFilterChainBuilder
s affect only newly created IoSession
s.java.lang.IllegalStateException
- if the current IoFilterChainBuilder
is
not a DefaultIoFilterChainBuilder