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

TimeScheduler: replace use of ScheduledThreadPoolExecutor with ConcurrentSkipListMap

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 2.11
    • None
    • None

      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...

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

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

                Created:
                Updated:
                Resolved: