public interface IoService
限定符和类型 | 方法和说明 |
---|---|
void |
addListener(IoServiceListener listener)
Adds an
IoServiceListener that listens any events related with
this service. |
java.util.Set<WriteFuture> |
broadcast(java.lang.Object message)
Writes the specified
message to all the IoSession s
managed by this service. |
void |
dispose()
Releases any resources allocated by this service.
|
void |
dispose(boolean awaitTermination)
Releases any resources allocated by this service.
|
long |
getActivationTime() |
DefaultIoFilterChainBuilder |
getFilterChain()
A shortcut for ( ( DefaultIoFilterChainBuilder )
getFilterChainBuilder() ). |
IoFilterChainBuilder |
getFilterChainBuilder() |
IoHandler |
getHandler() |
int |
getManagedSessionCount() |
java.util.Map<java.lang.Long,IoSession> |
getManagedSessions() |
int |
getScheduledWriteBytes() |
int |
getScheduledWriteMessages() |
IoSessionConfig |
getSessionConfig() |
IoSessionDataStructureFactory |
getSessionDataStructureFactory() |
IoServiceStatistics |
getStatistics() |
TransportMetadata |
getTransportMetadata() |
boolean |
isActive() |
boolean |
isDisposed() |
boolean |
isDisposing() |
void |
removeListener(IoServiceListener listener)
Removed an existing
IoServiceListener that listens any events
related with this service. |
void |
setFilterChainBuilder(IoFilterChainBuilder builder)
Sets the
IoFilterChainBuilder which will build the
IoFilterChain of all IoSession s which is created
by this service. |
void |
setHandler(IoHandler handler)
Sets the handler which will handle all connections managed by this service.
|
void |
setSessionDataStructureFactory(IoSessionDataStructureFactory sessionDataStructureFactory)
Sets the
IoSessionDataStructureFactory that provides
related data structures for a new session created by this service. |
TransportMetadata getTransportMetadata()
TransportMetadata
that this service runs on.void addListener(IoServiceListener listener)
IoServiceListener
that listens any events related with
this service.listener
- The listener to addvoid removeListener(IoServiceListener listener)
IoServiceListener
that listens any events
related with this service.listener
- The listener to useboolean isDisposing()
dispose()
method has
been called. Please note that this method will return true
even after all the related resources are released.boolean isDisposed()
void dispose()
void dispose(boolean awaitTermination)
awaitTermination
= true
will probably lead to a deadlock.awaitTermination
- When true this method will block until the underlying ExecutorService is terminatedIoHandler getHandler()
void setHandler(IoHandler handler)
handler
- The IoHandler to usejava.util.Map<java.lang.Long,IoSession> getManagedSessions()
ID
of the
session. An empty collection if there's no session.int getManagedSessionCount()
IoSessionConfig getSessionConfig()
IoSession
s
created by this service.IoFilterChainBuilder getFilterChainBuilder()
IoFilterChainBuilder
which will build the
IoFilterChain
of all IoSession
s which is created
by this service.
The default value is an empty DefaultIoFilterChainBuilder
.void setFilterChainBuilder(IoFilterChainBuilder builder)
IoFilterChainBuilder
which will build the
IoFilterChain
of all IoSession
s which is created
by this service.
If you specify null this property will be set to
an empty DefaultIoFilterChainBuilder
.builder
- The filter chain builder to useDefaultIoFilterChainBuilder 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
boolean isActive()
long getActivationTime()
java.util.Set<WriteFuture> broadcast(java.lang.Object message)
message
to all the IoSession
s
managed by this service. This method is a convenience shortcut for
IoUtil.broadcast(Object, Collection)
.message
- the message to broadcastIoSessionDataStructureFactory getSessionDataStructureFactory()
IoSessionDataStructureFactory
that provides
related data structures for a new session created by this service.void setSessionDataStructureFactory(IoSessionDataStructureFactory sessionDataStructureFactory)
IoSessionDataStructureFactory
that provides
related data structures for a new session created by this service.sessionDataStructureFactory
- The factory to useint getScheduledWriteBytes()
int getScheduledWriteMessages()
IoServiceStatistics getStatistics()