Package org.apache.mina.common.support
Class DelegatedIoAcceptor
java.lang.Object
org.apache.mina.common.support.DelegatedIoAcceptor
- All Implemented Interfaces:
IoAcceptor,IoService
- Direct Known Subclasses:
DatagramAcceptor
A delegated
IoAcceptor that wraps the other IoAcceptor.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(IoServiceListener listener) Adds anIoServiceListenerthat listens any events related with this service.voidbind(SocketAddress address, IoHandler handler) Binds to the specifiedaddressand handles incoming connections with the specifiedhandler.voidbind(SocketAddress address, IoHandler handler, IoServiceConfig config) Binds to the specifiedaddressand handles incoming connections with the specifiedhandler.Returns the default configuration which is used when you didn't specify any configuration.A shortcut for ( ( DefaultIoFilterChainBuilder )IoService.getFilterChainBuilder()).Returns the globalIoFilterChainBuilderwhich will modify theIoFilterChainof allIoSessions which is managed by this service.Returns allSocketAddresses 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 voidinit(IoAcceptor delegate) Sets the delegate.booleanisManaged(SocketAddress address) Returns true if this service is managing the specified serviceAddress.newSession(SocketAddress remoteAddress, SocketAddress localAddress) (Optional) Returns anIoSessionthat is bound to the specified localAddress and remoteAddress which reuses the localAddress that is already bound byIoAcceptorviaIoAcceptor.bind(SocketAddress, IoHandler).voidremoveListener(IoServiceListener listener) Removed an existingIoServiceListenerthat listens any events related with this service.voidSets the globalIoFilterChainBuilderwhich will modify theIoFilterChainof allIoSessions which is managed by this service.voidunbind(SocketAddress address) Unbinds from the specifiedaddressand disconnects all clients connected there.voidUnbinds all addresses which were bound by this acceptor.
-
Field Details
-
delegate
-
-
Constructor Details
-
DelegatedIoAcceptor
protected DelegatedIoAcceptor()Creates a new instance.
-
-
Method Details
-
init
Sets the delegate. This method should be invoked before any operations is requested. -
bind
Description copied from interface:IoAcceptorBinds to the specifiedaddressand handles incoming connections with the specifiedhandler.- Specified by:
bindin interfaceIoAcceptor- Throws:
IOException- if failed to bind
-
bind
public void bind(SocketAddress address, IoHandler handler, IoServiceConfig config) throws IOException Description copied from interface:IoAcceptorBinds to the specifiedaddressand handles incoming connections with the specifiedhandler.- Specified by:
bindin interfaceIoAcceptorconfig- the configuration- Throws:
IOException- if failed to bind
-
unbind
Description copied from interface:IoAcceptorUnbinds from the specifiedaddressand disconnects all clients connected there.- Specified by:
unbindin interfaceIoAcceptor
-
unbindAll
public void unbindAll()Description copied from interface:IoAcceptorUnbinds all addresses which were bound by this acceptor.- Specified by:
unbindAllin interfaceIoAcceptor
-
isManaged
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
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
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.
-
newSession
Description copied from interface:IoAcceptor(Optional) Returns anIoSessionthat is bound to the specified localAddress and remoteAddress which reuses the localAddress that is already bound byIoAcceptorviaIoAcceptor.bind(SocketAddress, IoHandler).This operation is optional. Please throw
UnsupportedOperationExceptionif the transport type doesn't support this operation. This operation is usually implemented for connectionless transport types.- Specified by:
newSessionin interfaceIoAcceptor
-
getDefaultConfig
Description copied from interface:IoServiceReturns the default configuration which is used when you didn't specify any configuration.- Specified by:
getDefaultConfigin interfaceIoService
-
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
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
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
Description copied from interface:IoServiceAdds anIoServiceListenerthat listens any events related with this service.- Specified by:
addListenerin interfaceIoService
-
removeListener
Description copied from interface:IoServiceRemoved an existingIoServiceListenerthat listens any events related with this service.- Specified by:
removeListenerin interfaceIoService
-