The overall idea is to avoid request processing bottleneck by allowing
a separate thread to process it (taken from a dedicated, say "worker"
pool) and releasing current IoProcessor thread for incoming events
(not for the same session).

This situation occurs when the server using Mina needs to perform a
database query to another machine to retrieve a result. The query may
take long time while the server may continue to accept user queries.At
the same time to control the number of queries for a particular
database, the idea is to create a separate thread with its own queue
intended to be executed onto that database. This is primarily to avoid
herd effect when there are several different clients competing for the
single database.

2011/9/7 Emmanuel Lécharny <[email protected]>:
> On 9/7/11 10:42 AM, Antonio Rodriges wrote:
>>
>> Hello, Emmanuel,
>>
>> Is it possible to:
>> 1) create manually additional threads
>
> In your application, you do whatever you want. Now, you have to be a bit
> more specific about your need...
>>
>> 2) pass a thread a session instance in messageReceived event
>
> You can, but keep in mind that doing so, you will release the IoProcessor
> thread, thus allowing another incoming request access the session instance.
>
> It's probably a better idea to copy the session content before passing it to
> a new thread.
>>
>> 3) continue receiving another events
>
> For the same session ?
>>
>> 4) once the thread with a passed session object is done it writes
>> output with session.write
>> Is it allowed behaviour within MIna framework? Any caveats?
>
> Ok, you probably want to explore the ExecutorFilter, which adds an Executor
> in the chain. Although it has some pitfalls, it can be useful.
>
> You need to give me some insights about your exact need, because it's
> usually not a good idea to add new threads..
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>



-- 
Kind regards,
Antonio Rodriges

Reply via email to