[ 
https://issues.apache.org/jira/browse/HBASE-6778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14278975#comment-14278975
 ] 

Jonathan Lawlor commented on HBASE-6778:
----------------------------------------

{quote}
If a thread is taking longer than its period, we won't schedule another 
instance of the same Chore type?
{quote}

That's correct [~stack]. The 
[ScheduledThreadPoolExecutor|http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html]
 enforces that functionality for all periodic tasks scheduled through 
scheduleAtFixedRate and scheduleWithFixedDelay calls. Specifically:

{quote}
Successive executions of a task scheduled via scheduleAtFixedRate or 
scheduleWithFixedDelay do not overlap. While different executions may be 
performed by different threads, the effects of prior executions happen-before 
those of subsequent ones. 
{quote}

In response to:
{quote}
Can we have it so pool has a small minimum and a max that allows all chores run 
concurrently if necessary
{quote}

This seems doable and would be the goal. The 
[ScheduledThreadPoolExecutor|http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html]
 provides a few mechanisms for controlling the number of active threads at any 
given time. Specifically, there is a timeout mechanism that allows us to 
specify a keep-alive-timer for threads and if a thread is idle for that period 
of time then it will terminate. Another mechanism for controlling the number of 
active threads to is to simply use setCorePoolSize which will expand or shrink 
the number of threads in the pool. This call is nice because in the case that 
we shrink the core pool size, it will not mindlessly shutdown threads. Instead 
it will wait for a thread to become idle before terminating it.






> Deprecate Chore; its a thread per task when we should have one thread to do 
> all tasks
> -------------------------------------------------------------------------------------
>
>                 Key: HBASE-6778
>                 URL: https://issues.apache.org/jira/browse/HBASE-6778
>             Project: HBase
>          Issue Type: Bug
>            Reporter: stack
>            Assignee: Jonathan Lawlor
>         Attachments: thread_dump_HMaster.local.out
>
>
> Should use something like ScheduledThreadPoolExecutor instead (Elliott said 
> this first I think; J-D said something similar just now).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to