Package org.apache.mina.common.support
Class DelegatedIoConnector
java.lang.Object
org.apache.mina.common.support.DelegatedIoConnector
- All Implemented Interfaces:
IoConnector
,IoService
- Direct Known Subclasses:
DatagramConnector
A delegated
IoConnector
that wraps the other IoConnector
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(IoServiceListener listener) Adds anIoServiceListener
that listens any events related with this service.connect
(SocketAddress address, SocketAddress localAddress, IoHandler handler) Connects to the specifiedaddress
.connect
(SocketAddress address, SocketAddress localAddress, IoHandler handler, IoServiceConfig config) Connects to the specifiedaddress
.connect
(SocketAddress address, IoHandler handler) Connects to the specifiedaddress
.connect
(SocketAddress address, IoHandler handler, IoServiceConfig config) Connects to the specifiedaddress
.Returns the default configuration which is used when you didn't specify any configuration.A shortcut for ( ( DefaultIoFilterChainBuilder )IoService.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.protected void
init
(IoConnector delegate) Sets the delegate.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.
-
Field Details
-
delegate
-
-
Constructor Details
-
DelegatedIoConnector
protected DelegatedIoConnector()Creates a new instance.
-
-
Method Details
-
init
Sets the delegate. This method should be invoked before any operation is requested. -
connect
Description copied from interface:IoConnector
Connects to the specifiedaddress
. If communication starts successfully, events are fired to the specifiedhandler
.- Specified by:
connect
in interfaceIoConnector
- Returns:
ConnectFuture
that will tell the result of the connection attempt
-
connect
Description copied from interface:IoConnector
Connects to the specifiedaddress
. If communication starts successfully, events are fired to the specifiedhandler
.- Specified by:
connect
in interfaceIoConnector
- Parameters:
config
- the configuration- Returns:
ConnectFuture
that will tell the result of the connection attempt
-
connect
Description copied from interface:IoConnector
Connects to the specifiedaddress
. If communication starts successfully, events are fired to the specifiedhandler
.- Specified by:
connect
in interfaceIoConnector
- Parameters:
localAddress
- the local address the channel is bound to- Returns:
ConnectFuture
that will tell the result of the connection attempt
-
connect
public ConnectFuture connect(SocketAddress address, SocketAddress localAddress, IoHandler handler, IoServiceConfig config) Description copied from interface:IoConnector
Connects to the specifiedaddress
. If communication starts successfully, events are fired to the specifiedhandler
.- Specified by:
connect
in interfaceIoConnector
- Parameters:
config
- the configuration- Returns:
ConnectFuture
that will tell the result of the connection attempt
-
isManaged
Description copied from interface:IoService
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. -
getManagedServiceAddresses
Description copied from interface:IoService
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.- Specified by:
getManagedServiceAddresses
in interfaceIoService
-
getManagedSessions
Description copied from interface:IoService
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.- Specified by:
getManagedSessions
in interfaceIoService
- Parameters:
serviceAddress
- the address to return all sessions for.- Returns:
- the sessions. An empty collection if there's no session.
-
getDefaultConfig
Description copied from interface:IoService
Returns the default configuration which is used when you didn't specify any configuration.- Specified by:
getDefaultConfig
in interfaceIoService
-
getFilterChainBuilder
Description copied from interface:IoService
Returns the globalIoFilterChainBuilder
which will modify theIoFilterChain
of allIoSession
s which is managed by this service. The default value is an emptyDefaultIoFilterChainBuilder
.- Specified by:
getFilterChainBuilder
in interfaceIoService
-
setFilterChainBuilder
Description copied from interface:IoService
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
.- Specified by:
setFilterChainBuilder
in interfaceIoService
-
getFilterChain
Description copied from interface:IoService
A shortcut for ( ( DefaultIoFilterChainBuilder )IoService.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.- Specified by:
getFilterChain
in interfaceIoService
-
addListener
Description copied from interface:IoService
Adds anIoServiceListener
that listens any events related with this service.- Specified by:
addListener
in interfaceIoService
-
removeListener
Description copied from interface:IoService
Removed an existingIoServiceListener
that listens any events related with this service.- Specified by:
removeListener
in interfaceIoService
-