protected void makeRunnerIfNeeded ( ) { // We don't need to make a SVG runner when there are no pending updates. boolean stop = true ; for ( WeakReference < UpdateRunner > wur : updaterunner ) { UpdateRunner ur = wur . get ( ) ; if ( ur == null ) { updaterunner . remove ( wur ) ; } else if ( ! ur . isEmpty ( ) ) { stop = false ; } } if ( stop ) { return ; } // We only need a new runner when we don't have one in the queue yet! if ( pending . get ( ) != null ) { return ; } // We need a component JSVGComponent component = this . cref . get ( ) ; if ( component == null ) { return ; } // Synchronize with all layers: synchronized ( this ) { synchronized ( component ) { UpdateManager um = component . getUpdateManager ( ) ; if ( um != null ) { synchronized ( um ) { if ( um . isRunning ( ) ) { // Create and insert a runner. Runnable newrunner = new Runnable ( ) { @ Override public void run ( ) { if ( pending . compareAndSet ( this , null ) ) { // Wake up all runners for ( WeakReference < UpdateRunner > wur : updaterunner ) { UpdateRunner ur = wur . get ( ) ; if ( ur == null || ur . isEmpty ( ) ) { continue ; } ur . runQueue ( ) ; } } } } ; pending . set ( newrunner ) ; um . getUpdateRunnableQueue ( ) . invokeLater ( newrunner ) ; return ; } } } } } }
Join the runnable queue of a component .