/* * (non-Javadoc) * * @see * org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */ public void afterPropertiesSet() throws Exception { File configFile = new File(Configure.getConfigFilename()); lastFileModifiedTime = configFile.lastModified(); scheduledExecutorService.scheduleWithFixedDelay( new Runnable() { public void run() { File configFile = new File(Configure.getConfigFilename()); // When two files' last modify time not equal, we consider it is // changed. synchronized (this) { if (configFile.lastModified() != lastFileModifiedTime) { lastFileModifiedTime = configFile.lastModified(); configFileLoader.reload(); } } } }, 500, 500, TimeUnit.MILLISECONDS); }