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
Modifier and TypeMethodDescriptionvoid
addListener
(IoServiceListener listener) Adds anIoServiceListener
that listens any events related with this service.Returns the default configuration which is used when you didn't specify any configuration.A shortcut for ( ( DefaultIoFilterChainBuilder )getFilterChainBuilder()
).Returns the globalIoFilterChainBuilder
which will modify theIoFilterChain
of allIoSession
s which is managed by this service.Returns allSocketAddress
es this service is managing.getManagedSessions
(SocketAddress serviceAddress) Returns all sessions with the specified remote or local address, which are currently managed by this service.boolean
isManaged
(SocketAddress serviceAddress) Returns true if this service is managing the specified serviceAddress.void
removeListener
(IoServiceListener listener) Removed an existingIoServiceListener
that listens any events related with this service.void
Sets the globalIoFilterChainBuilder
which will modify theIoFilterChain
of allIoSession
s which is managed by this service.
-
Method Details
-
addListener
Adds anIoServiceListener
that listens any events related with this service. -
removeListener
Removed an existingIoServiceListener
that listens any events related with this service. -
getManagedServiceAddresses
Set<SocketAddress> getManagedServiceAddresses()Returns allSocketAddress
es 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
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
Returns all sessions with the specified remote or local address, which are currently managed by this service.IoAcceptor
will assume the specified address is a local address, andIoConnector
will 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:
IllegalArgumentException
- if the specified address has not been bound.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 globalIoFilterChainBuilder
which will modify theIoFilterChain
of allIoSession
s which is managed by this service. The default value is an emptyDefaultIoFilterChainBuilder
. -
setFilterChainBuilder
Sets the globalIoFilterChainBuilder
which will modify theIoFilterChain
of allIoSession
s 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 realIoFilterChain
but aDefaultIoFilterChainBuilder
. Modifying the returned builder won't affect the existingIoSession
s at all, becauseIoFilterChainBuilder
s affect only newly createdIoSession
s.- Throws:
IllegalStateException
- if the currentIoFilterChainBuilder
is not aDefaultIoFilterChainBuilder
-