IoService introductionPage edited by Emmanuel LécharnyChanges (4)
Full Content
OverviewIoService provides basic I/O Service and manages I/O Sessions within MINA. Its one of the most crucial part of MINA Architecture. The implementing classes of IoService and child interface, are where most of the low level I/O operations are handled. IoService Mind MapLets try to see what are the responsibilities of the IoService and it implementing class AbstractIoService. Lets take a slightly different approach of first using a Ming Map and then jump into the inner working. The Mind Map was created using XMind. Interface DetailsIoService is the base interface for all the IoConnector's and IoAcceptor's that provides I/O services and manages I/O sessions. The interface has all the functions need to perform I/O related operations. Lets take a deep dive into the various methods in the interface
getTransportMetadata()This method returns the Transport meta-data the Acceptor or Connector is running. The typical details include provider name (nio, apr, rxtx), connection type (connectionless/connection oriented) etc. addListenerAllows to add a IoServiceListener to listen to specific events related to Ioservice. removeListenerRemoves specified IoServiceListener attached to this IoService. isDisposingThis method tells if the service is currently being disposed. As it can take a while, it's useful to know the current status of the service. isDisposedThis method tells if the service has been disposed. A service will be considered as disposed only when all the resources it has allocated have been released. disposeThis method releases all the resources the service has allocated. As it may take a while, the user should check the service status using the isDisposing() and isDisposed() to know if the service is now disposed completely. Always call dispose() when you shutdown a service ! getHandlerReturns the IoHandler associated with the service. setHandlerSets the IoHandler that will be responsible for handling all the events for the service. The handler contains your application logic ! getManagedSessionsReturns the map of all sessions which are currently managed by this service. A managed session is a session which is added to the service listener. It will be used to process the idle sessions, and other session aspects, depending on the kind of listeners a user adds to a service. getManagedSessionCountReturns the number of all sessions which are currently managed by this service. getSessionConfigReturns the session configuration. getFilterChainBuilderReturns the Filter chain builder. This is useful if one wants to add some new filter that will be injected when the sessions will be created. setFilterChainBuilderDefines the Filter chain builder to use with the service. getFilterChainReturns the current default Filter chain for the service. isActiveTells if the service is active or not. getActivationTimeReturns the time when this service was activated. It returns the last time when this service was activated if the service is not anymore active. broadcastWrites the given message to all the managed sessions. setSessionDataStructureFactorySets the IoSessionDataStructureFactory that provides related data structures for a new session created by this service. getScheduledWriteBytesReturns the number of bytes scheduled to be written (ie, the bytes stored in memory waiting for the socket to be ready for write). getScheduledWriteMessagesReturns the number of messages scheduled to be written (ie, the messages stored in memory waiting for the socket to be ready for write). getStatisticsReturns the IoServiceStatistics object for this service.
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache MINA > IoService introduction confluence
- [CONF] Apache MINA > IoService introduction confluence
