protected boolean waitForJobs ( ) throws InterruptedException { final Pair < Long , Job > peekPair ; try ( Guard ignored = timeQueue . lock ( ) ) { peekPair = timeQueue . peekPair ( ) ; } if ( peekPair == null ) { awake . acquire ( ) ; return true ; } final long timeout = Long . MAX_VALUE - peekPair . getFirst ( ) - System . currentTimeMillis ( ) ; if ( timeout < 0 ) { return false ; } return awake . tryAcquire ( timeout , TimeUnit . MILLISECONDS ) ; }
returns true if a job was queued within a timeout