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

Avoid copying of pulse listener lists in Toolkit

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:

      Description

      We could use copy-on-write approach instead of copying on every pulse;

      This means, in synchronized block, we'd set some flag:
      synchronized(this) {
         stagePulseListInUse = scenePulseListInUse = postScenePulseListInUse = true;
      }

      and unset them at the end of the pulse.

      Then instead of full copies, do just reference copy:
      final Map<TKPulseListener,AccessControlContext> stagePulseList = stagePulseListeners;
      ...

      The add*Listener methods would look like:
       
      synchronized(this) {
          AccessControlContext acc = AccessController.getContext();
          if (stagePulseListInUse) {
              stagePulseListInUse = false;
              stagePulseListeners = new WeakHashMap<>(stagePulseListeners);
          }
          stagePulseListeners.add(listener);
      }

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            msladecek Martin Sládeček
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Imported: