Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1051

TimeScheduler: replace use of ScheduledThreadPoolExecutor with ConcurrentSkipListMap

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 2.11
    • None
    • None
    • 0
    • 0% 0%

    Description

      TimeScheduler currently extends ScheduledThreadPoolExecutor, which uses a DelayQueue for keeping an ordered list of tasks (ordered by their execution times).
      DelayQueue doesn't provide good speed, e.g. (IIRC) remove() requires a linear list scan.

      ConcurrentSkipListMap however provides O(log) cost for get(), put(), remove() and containsKey(). Attached is a cursory impl of TimeScheduler based on ConcurrentSkipListMap. It is faster than the old version.

      Since ConcurrentSkipListMap requires JDK 1.6, we cannot use this in 2.6.x. It can be used in 3.0 only, or perhaps - after a discussion on the mailing list - in 2.9...

      Attachments

        1. timer.zip
          24 kB
        2. TimeScheduler.java
          15 kB
        3. TimeScheduler.patch
          4 kB

        Issue Links

          Activity

            People

              rhn-engineering-bban Bela Ban
              rhn-engineering-bban Bela Ban
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: