Package org.apache.mina.common
Interface IoService
-
- All Known Subinterfaces:
IoAcceptor,IoConnector
- All Known Implementing Classes:
BaseIoAcceptor,BaseIoConnector,BaseIoService,DatagramAcceptor,DatagramAcceptorDelegate,DatagramConnector,DatagramConnectorDelegate,DelegatedIoAcceptor,DelegatedIoConnector,SocketAcceptor,SocketConnector,VmPipeAcceptor,VmPipeConnector
public interface IoService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(IoServiceListener listener)Adds anIoServiceListenerthat listens any events related with this service.IoServiceConfiggetDefaultConfig()Returns the default configuration which is used when you didn't specify any configuration.DefaultIoFilterChainBuildergetFilterChain()A shortcut for ( ( DefaultIoFilterChainBuilder )getFilterChainBuilder()).IoFilterChainBuildergetFilterChainBuilder()Returns the globalIoFilterChainBuilderwhich will modify theIoFilterChainof allIoSessions which is managed by this service.java.util.Set<java.net.SocketAddress>getManagedServiceAddresses()Returns allSocketAddresses 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.booleanisManaged(java.net.SocketAddress serviceAddress)Returns true if this service is managing the specified serviceAddress.voidremoveListener(IoServiceListener listener)Removed an existingIoServiceListenerthat listens any events related with this service.voidsetFilterChainBuilder(IoFilterChainBuilder builder)Sets the globalIoFilterChainBuilderwhich will modify theIoFilterChainof allIoSessions which is managed by this service.
-
-
-
Method Detail
-
addListener
void addListener(IoServiceListener listener)
Adds anIoServiceListenerthat listens any events related with this service.
-
removeListener
void removeListener(IoServiceListener listener)
Removed an existingIoServiceListenerthat listens any events related with this service.
-
getManagedServiceAddresses
java.util.Set<java.net.SocketAddress> getManagedServiceAddresses()
Returns allSocketAddresses this service is managing. If this service is anIoAcceptor, a set of bind addresses will be returned. If this service is anIoConnector, a set of remote addresses will be returned.
-
isManaged
boolean isManaged(java.net.SocketAddress serviceAddress)
Returns true if this service is managing the specified serviceAddress. If this service is anIoAcceptor, serviceAddress is a bind address. If this service is anIoConnector, serviceAddress is a remote address.
-
getManagedSessions
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.IoAcceptorwill assume the specified address is a local address, andIoConnectorwill assume it's a remote address.- Parameters:
serviceAddress- the address to return all sessions for.- Returns:
- the sessions. An empty collection if there's no session.
- Throws:
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 thisIoService.
-
getDefaultConfig
IoServiceConfig getDefaultConfig()
Returns the default configuration which is used when you didn't specify any configuration.
-
getFilterChainBuilder
IoFilterChainBuilder getFilterChainBuilder()
Returns the globalIoFilterChainBuilderwhich will modify theIoFilterChainof allIoSessions which is managed by this service. The default value is an emptyDefaultIoFilterChainBuilder.
-
setFilterChainBuilder
void setFilterChainBuilder(IoFilterChainBuilder builder)
Sets the globalIoFilterChainBuilderwhich will modify theIoFilterChainof allIoSessions which is managed by this service. If you specify null this property will be set to an emptyDefaultIoFilterChainBuilder.
-
getFilterChain
DefaultIoFilterChainBuilder getFilterChain()
A shortcut for ( ( DefaultIoFilterChainBuilder )getFilterChainBuilder()). Please note that the returned object is not a realIoFilterChainbut aDefaultIoFilterChainBuilder. Modifying the returned builder won't affect the existingIoSessions at all, becauseIoFilterChainBuilders affect only newly createdIoSessions.- Throws:
java.lang.IllegalStateException- if the currentIoFilterChainBuilderis not aDefaultIoFilterChainBuilder
-
-