@ Override public void start ( Set < File > files , Consumer < Set < File > > callback ) { if ( isStarted ( ) ) { throw new IllegalStateException ( "start() should not be called more than once" ) ; } Set < File > filesCopy = ImmutableSet . copyOf ( files ) ; Preconditions . checkArgument ( filesCopy . size ( ) > 0 , "must specify at least 1 file to watch for changes" ) ; this . callback = requireNonNull ( callback ) ; watchedFiles = filesCopy ; executorService = MoreExecutors . listeningDecorator ( Executors . newScheduledThreadPool ( 1 ) ) ; future = executorService . scheduleAtFixedRate ( this :: scanFilesForChanges , initialDelay , interval , timeUnit ) ; }
Starts polling the watched files for changes .