@ Override public void run ( ) { final ScheduledFuture < ? > future = this . executor . scheduleWithFixedDelay ( this . scheduled , 0 , this . delayMillis , TimeUnit . MILLISECONDS ) ; try { this . runTrigger . await ( ) ; } catch ( final InterruptedException e ) { this . listener . handle ( e ) ; } finally { future . cancel ( true ) ; // stop the periodic reading this . scheduled . cleanup ( ) ; this . executor . shutdownNow ( ) ; this . listener . destroy ( ) ; } }
Follows changes in the file calling the TailerListener s handle method for each new line .