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
public class DelegatedIoConnector extends java.lang.Object implements IoConnector
A delegatedIoConnectorthat wraps the otherIoConnector.
-
-
Field Summary
Fields Modifier and Type Field Description protected IoConnectordelegate
-
Constructor Summary
Constructors Modifier Constructor Description protectedDelegatedIoConnector()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(IoServiceListener listener)Adds anIoServiceListenerthat listens any events related with this service.ConnectFutureconnect(java.net.SocketAddress address, java.net.SocketAddress localAddress, IoHandler handler)Connects to the specifiedaddress.ConnectFutureconnect(java.net.SocketAddress address, java.net.SocketAddress localAddress, IoHandler handler, IoServiceConfig config)Connects to the specifiedaddress.ConnectFutureconnect(java.net.SocketAddress address, IoHandler handler)Connects to the specifiedaddress.ConnectFutureconnect(java.net.SocketAddress address, IoHandler handler, IoServiceConfig config)Connects to the specifiedaddress.IoServiceConfiggetDefaultConfig()Returns the default configuration which is used when you didn't specify any configuration.DefaultIoFilterChainBuildergetFilterChain()A shortcut for ( ( DefaultIoFilterChainBuilder )IoService.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.protected voidinit(IoConnector delegate)Sets the delegate.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.
-
-
-
Field Detail
-
delegate
protected IoConnector delegate
-
-
Method Detail
-
init
protected void init(IoConnector delegate)
Sets the delegate. This method should be invoked before any operation is requested.
-
connect
public ConnectFuture connect(java.net.SocketAddress address, IoHandler handler)
Description copied from interface:IoConnectorConnects to the specifiedaddress. If communication starts successfully, events are fired to the specifiedhandler.- Specified by:
connectin interfaceIoConnector- Returns:
ConnectFuturethat will tell the result of the connection attempt
-
connect
public ConnectFuture connect(java.net.SocketAddress address, IoHandler handler, IoServiceConfig config)
Description copied from interface:IoConnectorConnects to the specifiedaddress. If communication starts successfully, events are fired to the specifiedhandler.- Specified by:
connectin interfaceIoConnectorconfig- the configuration- Returns:
ConnectFuturethat will tell the result of the connection attempt
-
connect
public ConnectFuture connect(java.net.SocketAddress address, java.net.SocketAddress localAddress, IoHandler handler)
Description copied from interface:IoConnectorConnects to the specifiedaddress. If communication starts successfully, events are fired to the specifiedhandler.- Specified by:
connectin interfaceIoConnectorlocalAddress- the local address the channel is bound to- Returns:
ConnectFuturethat will tell the result of the connection attempt
-
connect
public ConnectFuture connect(java.net.SocketAddress address, java.net.SocketAddress localAddress, IoHandler handler, IoServiceConfig config)
Description copied from interface:IoConnectorConnects to the specifiedaddress. If communication starts successfully, events are fired to the specifiedhandler.- Specified by:
connectin interfaceIoConnectorconfig- the configuration- Returns:
ConnectFuturethat will tell the result of the connection attempt
-
isManaged
public boolean isManaged(java.net.SocketAddress serviceAddress)
Description copied from interface:IoServiceReturns 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
public java.util.Set<java.net.SocketAddress> getManagedServiceAddresses()
Description copied from interface:IoServiceReturns 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.- Specified by:
getManagedServiceAddressesin interfaceIoService
-
getManagedSessions
public java.util.Set<IoSession> getManagedSessions(java.net.SocketAddress serviceAddress)
Description copied from interface:IoServiceReturns 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.- Specified by:
getManagedSessionsin interfaceIoService- Parameters:
serviceAddress- the address to return all sessions for.- Returns:
- the sessions. An empty collection if there's no session.
-
getDefaultConfig
public IoServiceConfig getDefaultConfig()
Description copied from interface:IoServiceReturns the default configuration which is used when you didn't specify any configuration.- Specified by:
getDefaultConfigin interfaceIoService
-
getFilterChainBuilder
public IoFilterChainBuilder getFilterChainBuilder()
Description copied from interface:IoServiceReturns the globalIoFilterChainBuilderwhich will modify theIoFilterChainof allIoSessions which is managed by this service. The default value is an emptyDefaultIoFilterChainBuilder.- Specified by:
getFilterChainBuilderin interfaceIoService
-
setFilterChainBuilder
public void setFilterChainBuilder(IoFilterChainBuilder builder)
Description copied from interface:IoServiceSets the globalIoFilterChainBuilderwhich will modify theIoFilterChainof allIoSessions which is managed by this service. If you specify null this property will be set to an emptyDefaultIoFilterChainBuilder.- Specified by:
setFilterChainBuilderin interfaceIoService
-
getFilterChain
public DefaultIoFilterChainBuilder getFilterChain()
Description copied from interface:IoServiceA shortcut for ( ( DefaultIoFilterChainBuilder )IoService.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.- Specified by:
getFilterChainin interfaceIoService
-
addListener
public void addListener(IoServiceListener listener)
Description copied from interface:IoServiceAdds anIoServiceListenerthat listens any events related with this service.- Specified by:
addListenerin interfaceIoService
-
removeListener
public void removeListener(IoServiceListener listener)
Description copied from interface:IoServiceRemoved an existingIoServiceListenerthat listens any events related with this service.- Specified by:
removeListenerin interfaceIoService
-
-