private void start ( Runnable timeoutTask , long remainingNanos ) { lock . writeLock ( ) . lock ( ) ; try { this . timeoutTask = timeoutTask ; this . start = System . nanoTime ( ) ; this . targetEnd = start + remainingNanos ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { debugTime ( ">Start {0}" , this . start ) ; debugTime ( ">Target {0}" , this . targetEnd ) ; debugTime ( ">Now {0}" , this . start ) ; debugTime ( ">Remain {0}" , remainingNanos ) ; } Runnable task = ( ) -> { timeout ( ) ; } ; if ( remainingNanos > FTConstants . MIN_TIMEOUT_NANO ) { this . future = scheduledExecutorService . schedule ( task , remainingNanos , TimeUnit . NANOSECONDS ) ; } else { task . run ( ) ; } } finally { lock . writeLock ( ) . unlock ( ) ; } }
This is the method which actually starts the timer