[jboss-jira] [JBoss JIRA] (JGRP-1553) TimeScheduler3
Bela Ban (JIRA)
jira-events at lists.jboss.org
Mon Dec 17 09:03:08 EST 2012
[ https://issues.jboss.org/browse/JGRP-1553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741862#comment-12741862 ]
Bela Ban commented on JGRP-1553:
--------------------------------
The above code looks similar to what ScheduledThreadPoolExecutor does (with DelayQueue/PriorityQueue). Also, after the simplications of NAKACK{2} and UNICAST{2}, we won't have many tasks in a timer.
Therefore I'll do the following:
#1 Either fix the above problems in TimeScheduler2 directly, or write a new TimeScheduler3 to do that
#2 default back to timer_type="old". This uses the DefaultTimeScheduler, which intenally uses ScheduledThreadPoolExecutor. This is probably good enough, as we won't have many tasks in the timer.
> TimeScheduler3
> --------------
>
> Key: JGRP-1553
> URL: https://issues.jboss.org/browse/JGRP-1553
> Project: JGroups
> Issue Type: Enhancement
> Reporter: Bela Ban
> Assignee: Bela Ban
> Fix For: 3.3
>
>
> The current TimeScheduler2 class has a few deficiencies:
> - taskReady() should only set next-execution-time if its argument is less than next-execution-time
> - no_tasks: when setting this CAS, the result is only checked in 1 location, but not the other
> - Potential loss of task: when calling schedule() on an existing Entry (same execution time), and - before adding the task to Entry - Entry is removed by _run() as it was executed, then the newly added task will never get to run !
> - Simplification: instead of headMap(), just use firstEntry(), removeFirstEntry(). See pseudo code below.
> As a workaround, timer_type="old" will switch back to the previous default timer. The reason for TimeScheduler3 (versus changing TimeScheduler2) is that we can simply switch to the new impl by setting (a new) timer_type="new2". Should this have a bug, we can simply switch back to "new" or "old" (or "wheel".
> Over time, TimeScheduler2 will get removed.
> Pseudo code:
> * loop while has tasks
> ** get the first task
> ** if its time is less than the current time: execute it and remove it
> ** else block (on the next task or 10s) until an element is added
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list