mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "slump" <slump2...@21cn.com>
Subject Re: Re: race condition in OrderedThreadPoolExecutor/UnorderedThreadPoolExecutor
Date Mon, 06 Oct 2008 03:45:17 GMT
>>At worst, you will have a task waiting for a thread in the queue, until another task
finish. This is a
>>best effort system, where you create a new thread if there is none
>>remaining, which does not mean each incoming task will be affected to
>>this new thread.

yes, the new task will be executed at last
but it seems the concurrent worker threads is less than maximumPoolSize   which is spcified
in constructor 
I think when there are tasks in queue and worker threads <max-thread  
new worker threads should be created just like in JDK's ThreadPoolExecutor 

But if in design goal , maximumPoolSize don't mean create new thread EVERY time  in this situation,
it is OK.

Thank you for the reply.




slump
2008-10-06



发件人: Emmanuel Lecharny
发送时间: 2008-09-29 02:27:39
收件人: dev@mina.apache.org
抄送: 
主题: Re: race condition in OrderedThreadPoolExecutor/UnorderedThreadPoolExecutor

slump wrote:
> I think I found a race condition in OrderedThreadPoolExecutor/UnorderedThreadPoolExecutor
>  <snip/ >
> And in OrderedThreadPoolExecutor  , have the same race condition.
>   
I don't think there is a race condition. At worst, you will have a task
waiting for a thread in the queue, until another task finish. This is a
best effort system, where you create a new thread if there is none
remaining, which does not mean each incoming task will be affected to
this new thread.
> And I have one more question: 
> Why not just use  ThreadPoolExecutor in JDK instead of  UnorderedThreadPoolExecutor?

> does UnorderedThreadPoolExecutor have some special requirement which  ThreadPoolExecutor
can't fulfil?
>   
The class javadoc is pretty clear about the diffeence between the
UnorderedThreadPoolExecutor and the JDK ThreadPollExecutor class. And
you can verify that the MINA class extends the ThreadPollExecutor class.
It just add extra semantic.

Hope it helps.
>   


-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message