Uploaded image for project: 'Accumulo'
  1. Accumulo
  2. ACCUMULO-2419

Improve SimpleTimer by replacing java.util.Timer

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.7.0
    • tserver

    Description

      The server utility class SimpleTimer uses a java.util.Timer under the hood for scheduling tasks. From Java Concurrency in Practice, p. 123:

      Timer has some drawbacks, and ScheduledThreadPoolExecutor should be thought of as its replacement. ... there is little reason to use Timer in Java 5.0 or later.

      The purpose of SimpleTimer is "to reduce the number of threads dedicated to simple events", but a user cannot opt to let more than one thread handle the events on systems that can take the load. Also, if any task does take a long time for some reason, execution of other tasks is affected.

      The Timer in SimpleTimer should be replaced with ScheduledThreadPoolExecutor, and the class should allow for more than one thread to be used for task execution.

      Attachments

        Issue Links

          Activity

            People

              bhavanki Bill Havanki
              bhavanki Bill Havanki
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: