blob: 9ecbce5563749b954f08dbd459aca43b101b8e0b [file] [log] [blame]
Title: Chapter 10 - Executor Filter
NavPrev: ../ch9-codec-filter/ch9-codec-filter.html
NavPrevText: Chapter 9 - Codec Filter
NavUp: ../user-guide-toc.html
NavUpText: User Guide
NavNext: ../ch11-ssl-filter/ch11-ssl-filter.html
NavNextText: Chapter 11 - SSL Filter
Notice: Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
# Chapter 10 - Executor Filter
MINA 1.X version let the user define the Thread Model at the Acceptor level. It was part of the Acceptor configuration. This led to complexity, and the MINA team decided to remove this option, replacing it with a much more versatile system, based on a filter : the __ExecutorFilter__.
## The ExecutorFilter class
This class is implementing the IoFilter interface, and basically, it contains an Executor to spread the incoming events to a pool of threads. This will allow an application to use more efficiently the processors, if some tasks are CPU intensive.
This Filter can be used just before the handlers, assuming that most of the processing will be done in your application, or somewhere before some CPU intensive filter (for instance, a CodecFilter).
It uses an _Executor_ instance to process the tasks, and can limit the number of events that can be sent to this executor. By default, the following events can be passed to the executor:
* close
* event
* exceptionCaught
* inputClosed
* messageReceived
* messageSent
* sessionCreated
* sessionClosed
* sessionIdle
* sessionOpened
* write