Class UpdateRunner


  • public class UpdateRunner
    extends java.lang.Object
    Class to handle updates to an SVG plot, in particular when used in an Apache Batik UI.
    Since:
    0.3
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.ConcurrentLinkedQueue<java.lang.Runnable> queue
      The queue of pending updates
      private java.lang.Object sync
      Owner/Synchronization object
      private UpdateSynchronizer synchronizer
      Synchronizer that can block events from being executed right away.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected UpdateRunner​(java.lang.Object sync)
      Construct a new update handler
    • Field Detail

      • sync

        private java.lang.Object sync
        Owner/Synchronization object
      • queue

        private final java.util.concurrent.ConcurrentLinkedQueue<java.lang.Runnable> queue
        The queue of pending updates
      • synchronizer

        private UpdateSynchronizer synchronizer
        Synchronizer that can block events from being executed right away.
    • Constructor Detail

      • UpdateRunner

        protected UpdateRunner​(java.lang.Object sync)
        Construct a new update handler
        Parameters:
        sync - Object to synchronize on
    • Method Detail

      • invokeLater

        public void invokeLater​(java.lang.Runnable r)
        Add a new update to run at any appropriate time.
        Parameters:
        r - New runnable to perform the update
      • runQueue

        public void runQueue()
        Run the processing queue now. This should usually be only invoked by the UpdateSynchronizer
      • clear

        public void clear()
        Clear queue. For shutdown!
      • isEmpty

        public boolean isEmpty()
        Check whether the queue is empty.
        Returns:
        queue status
      • synchronizeWith

        public void synchronizeWith​(UpdateSynchronizer newsync)
        Set a new update synchronizer.
        Parameters:
        newsync - Update synchronizer
      • unsynchronizeWith

        public void unsynchronizeWith​(UpdateSynchronizer oldsync)
        Remove an update synchronizer
        Parameters:
        oldsync - Update synchronizer to remove