public synchronized boolean reloadConfigsIfNecessary ( ) { long time = RaidNode . now ( ) ; if ( time > lastReloadAttempt + reloadInterval ) { lastReloadAttempt = time ; try { File file = new File ( configFileName ) ; long lastModified = file . lastModified ( ) ; if ( lastModified > lastSuccessfulReload && time > lastModified + RELOAD_WAIT ) { reloadConfigs ( ) ; lastSuccessfulReload = time ; lastReloadAttemptFailed = false ; return true ; } } catch ( Exception e ) { if ( ! lastReloadAttemptFailed ) { LOG . error ( "Failed to reload config file - " + "will use existing configuration." , e ) ; } lastReloadAttemptFailed = true ; } } return false ; }
Reload config file if it hasn t been loaded in a while Returns true if the file was reloaded .