Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8126677

Lens: LensTimer::_start might have a wrong implementation


    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Not an Issue
    • Affects Version/s: None
    • Fix Version/s: 8
    • Component/s: javafx


      Found it while browsing the code - need further testing and investigation

      1. the _start function receive a runnable as an argument, but the timer will always run with the runnable that it was created with.
      2. The _Start method always return 1 as a pointer to the timer - should return a hash value or the reference of the object itself, so timers can be distinguished. Need to check if more then one timer can be created in runtime.
      3. generic comment - the javadoc states that this implementation should provide high resolution timer (i.e hardware timer), but LensTimer is implemented with java timers. Other platforms do use native timers. Need to check if this important, when the timer used and for what.

      Code snippet:
      @Override protected long _start(final Runnable runnable, int period) {
              if (timer == null) {
                  timer = new java.util.Timer(true);

              timer.schedule(task, 0, (long)period); //->> should used if runnable == null, otherwise should use timer.schedule(runnable, 0, (long)period)
              return 1; // need something non-zero to denote success.


        1. GlassTimer.c
          4 kB
          David Hill
        2. X11Timer.java
          0.9 kB
          David Hill



            • Assignee:
              ayavnai Assaf Yavnai (Inactive)
              ayavnai Assaf Yavnai (Inactive)
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: