Source:
<code>public void start() { if (!lifecycleLock.canStart()) { throw new ISE("can't start."); } LOG.info("Starting CoordinatorPollingBasicAuthenticatorCacheManager."); try { initUserMaps(); ScheduledExecutors.scheduleWithFixedDelay( exec, new Duration(commonCacheConfig.getPollingPeriod()), new Duration(commonCacheConfig.getPollingPeriod()), () -> { try { long randomDelay = ThreadLocalRandom.current().nextLong(0, commonCacheConfig.getMaxRandomDelay()); LOG.debug("Inserting cachedUserMaps random polling delay of [%s] ms", randomDelay); Thread.sleep(randomDelay); LOG.debug("Scheduled user cache poll is running"); for (String authenticatorPrefix : authenticatorPrefixes) { Map<String, BasicAuthenticatorUser> userMap = fetchUserMapFromCoordinator(authenticatorPrefix, false); if (userMap != null) { cachedUserMaps.put(authenticatorPrefix, userMap); } } LOG.debug("Scheduled user cache poll is done"); } catch (Throwable t) { LOG.makeAlert(t, "Error occured while polling for cachedUserMaps.").emit(); } } ); <START> ScheduledExecutors.scheduleWithFixedDelay( <END> exec, new Duration(commonCacheConfig.getPollingPeriod()), new Duration(commonCacheConfig.getPollingPeriod()), () -> { try { long randomDelay = ThreadLocalRandom.current().nextLong(0, commonCacheConfig.getMaxRandomDelay()); LOG.debug("Inserting cachedConfigs random polling delay of [%s] ms", randomDelay); Thread.sleep(randomDelay); LOG.debug("Scheduled config cache poll is running"); for (String authenticatorPrefix : authenticatorPrefixes) { BasicAuthConfig config = fetchConfigFromCoordinator(authenticatorPrefix); if (config != null) { cachedConfigs.put(authenticatorPrefix, config); } } LOG.debug("Scheduled config cache poll is done"); } catch (Throwable t) { LOG.makeAlert(t, "Error occured while polling for cachedConfigs.").emit(); } } ); lifecycleLock.started(); LOG.info("Started CoordinatorPollingBasicAuthenticatorCacheManager."); } finally { lifecycleLock.exitStart(); } }</code><technical_language>nit: ok poll config userMap in scheduler</technical_language>

Target:
public void start() { if (!lifecycleLock.canStart()) { throw new ISE("can't start."); } LOG.info("Starting CoordinatorPollingBasicAuthenticatorCacheManager."); try { initUserMaps(); ScheduledExecutors.scheduleWithFixedDelay( exec, new Duration(commonCacheConfig.getPollingPeriod()), new Duration(commonCacheConfig.getPollingPeriod()), () -> { try { long randomDelay = ThreadLocalRandom.current().nextLong(0, commonCacheConfig.getMaxRandomDelay()); LOG.debug("Inserting cachedUserMaps random polling delay of [%s] ms", randomDelay); Thread.sleep(randomDelay); LOG.debug("Scheduled user cache poll is running"); for (String authenticatorPrefix : authenticatorPrefixes) { Map<String, BasicAuthenticatorUser> userMap = fetchUserMapFromCoordinator(authenticatorPrefix, false); if (userMap != null) { cachedUserMaps.put(authenticatorPrefix, userMap); } } LOG.debug("Scheduled user cache poll is done"); } catch (Throwable t) { LOG.makeAlert(t, "Error occured while polling for cachedUserMaps.").emit(); } } ); lifecycleLock.started(); LOG.info("Started CoordinatorPollingBasicAuthenticatorCacheManager."); } finally { lifecycleLock.exitStart(); } }