void () { PropertiesComponent propertyService = PropertiesComponent.getInstance(); if (ConfigImportHelper.isConfigImported()) { long scheduledAt = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(OLD_DIRECTORIES_SCAN_DELAY_DAYS); LOG.info("scheduling old directories scan after " + DateFormatUtil.formatDateTime(scheduledAt)); propertyService.setValue(OLD_DIRECTORIES_SCAN_SCHEDULED, Long.toString(scheduledAt)); OldDirectoryCleaner.Stats.scheduled(); } else { long scheduledAt = propertyService.getLong(OLD_DIRECTORIES_SCAN_SCHEDULED, 0L), now; if (scheduledAt != 0 && (now = System.currentTimeMillis()) >= scheduledAt) { OldDirectoryCleaner.Stats.started((int)TimeUnit.MILLISECONDS.toDays(now - scheduledAt) + OLD_DIRECTORIES_SCAN_DELAY_DAYS); LOG.info("starting old directories scan"); long expireAfter = now - TimeUnit.DAYS.toMillis(OLD_DIRECTORIES_SHELF_LIFE_DAYS); new OldDirectoryCleaner(expireAfter).seekAndDestroy(null, null); propertyService.unsetValue(OLD_DIRECTORIES_SCAN_SCHEDULED); LOG.info("old directories scan complete"); } } }