public void startChecking ( ) { // synchronize with other attempts to update the running task synchronized ( runningTaskLock ) { // check if not already active if ( runningTask == null ) { // only activate if at least one stop criterion has been set if ( ! stopCriteria . isEmpty ( ) ) { // schedule periodical check runningTask = new StopCriterionCheckTask ( ) ; runningTaskFuture = SCHEDULER . scheduleWithFixedDelay ( runningTask , period , period , periodTimeUnit ) ; // log LOGGER . debug ( "Stop criterion checker for search {} activated" , search ) ; } } else { // issue a warning LOGGER . warn ( "Attempted to activate already active stop criterion checker for search {}" , search ) ; } } }
Start checking the stop criteria in a separate background thread . If the stop criterion checker is already active or if no stop criteria have been added calling this method does not have any effect .