private void internal_start ( final long waitTime ) throws RejectedExecutionException , CouldNotPerformException { synchronized ( lock ) { if ( isActive ( ) ) { logger . debug ( "Reject start, not interrupted or expired." ) ; return ; } expired = false ; timerTask = GlobalScheduledExecutorService . schedule ( ( Callable < Void > ) ( ) -> { synchronized ( lock ) { try { logger . debug ( "Wait for timeout TimeOut interrupted." ) ; if ( timerTask . isCancelled ( ) ) { logger . debug ( "TimeOut was canceled." ) ; return null ; } logger . debug ( "Expire..." ) ; expired = true ; } finally { timerTask = null ; } } try { expired ( ) ; } catch ( Exception ex ) { ExceptionPrinter . printHistory ( new CouldNotPerformException ( "Error during timeout handling!" , ex ) , logger , LogLevel . WARN ) ; } logger . debug ( "Worker finished." ) ; return null ; } , waitTime , TimeUnit . MILLISECONDS ) ; } }
Internal synchronized start method .