Thank you Niklas,

I will look at the codes you recommended.

As far as I know, there is one IoHandler for one IoPorcessor thread if no 
ExecutorFilter is inserted into the filter chain, is that correct?

If I insert the ExecutorFilter into to the filter chain, then what's the 
relationship between the IoHander threads (or the ExecturoFilter threads) and 
the IoProcessor threads?

And if the actual works are done in the IoHandler, then if I have lots of 
clients connect to the server concurrently, will it make some clients' request 
to be wait until the other clients' request have been deal with?

My original idea is to do the actual database works in some other threads but 
not using the ExecutorFilter, and then using the BlockingQueue to exchange 
information between these worker threads and the IoHander threads. But if the 
client has to wait for the server's response message, then it seems that this 
method is not so efficiently, I doubt that the IoHandler will be blocked when 
it is waiting for the workers thread's response, so that will make the other 
clients' request can not be accessed in time.

Thanks.

Steven

 
 

在2008-03-18,"Niklas Gustavsson" <[EMAIL PROTECTED]> 写道:

On Tue, Mar 18, 2008 at 7:46 AM, Steven <[EMAIL PROTECTED]> wrote:
>  Is it proper to create an class that extends the ExecutorFilter class and do 
> the db works in this class' messageReceived and messageSent methods?

No, you would do the actual work in your IoHandler. The ExecutorFilter
you would insert directly into the filter chain. You can have a look
at how we use it in FtpServer which is kind of similar as some data
transfers can take a lot of time:
http://svn.apache.org/repos/asf/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/listener/mina/MinaListener.java

/niklas

Reply via email to