public void tick ( long duration , TimeUnit timeUnit ) { long remaining = toTicks ( duration , timeUnit ) ; do { remaining = deltaQueue . tick ( remaining ) ; runUntilIdle ( ) ; } while ( deltaQueue . isNotEmpty ( ) && remaining > 0 ) ; }
Runs time forwards by a given duration executing any commands scheduled for execution during that time period and any background tasks spawned by the scheduled tasks . Therefore when a call to tick returns the executor will be idle .