public void update() throws Exception { if( null != curatorFramework ) { ConfigurationsUtils.updateConfigsFromZookeeper(this, this.curatorFramework); } else { updateGlobalConfig(ConfigurationsUtils.readGlobalConfigFromFile(configFileRoot.toAbsolutePath().toString())); } } }
public static void updateParserConfigsFromZookeeper(ParserConfigurations configurations, CuratorFramework client) throws Exception { updateConfigsFromZookeeper( configurations , PARSER , sensorType -> configurations.updateSensorParserConfig(sensorType, readSensorParserConfigBytesFromZookeeper(sensorType, client)) , client ); }
public static void updateSensorIndexingConfigsFromZookeeper(IndexingConfigurations configurations, CuratorFramework client) throws Exception { updateConfigsFromZookeeper( configurations , INDEXING , sensorType -> configurations.updateSensorIndexingConfig(sensorType, readSensorIndexingConfigBytesFromZookeeper(sensorType, client)) , client ); }
public static void updateEnrichmentConfigsFromZookeeper(EnrichmentConfigurations configurations, CuratorFramework client) throws Exception { updateConfigsFromZookeeper( configurations , ENRICHMENT , sensorType -> configurations.updateSensorEnrichmentConfig(sensorType, readSensorEnrichmentConfigBytesFromZookeeper(sensorType, client)) , client ); }
private static void updateConfigsFromZookeeper( Configurations configurations , ConfigurationType type , Callback callback , CuratorFramework client ) throws Exception { Exception globalUpdateException = null; try { updateConfigsFromZookeeper(configurations, client); } catch(Exception e) { LOG.warn("Unable to update global config when updating indexing configs: " + e.getMessage(), e); globalUpdateException = e; } List<String> sensorTypes = client.getChildren().forPath(type.getZookeeperRoot()); for(String sensorType: sensorTypes) { callback.apply(sensorType); } if(globalUpdateException != null) { throw globalUpdateException; } }
@Override public void forceUpdate(CuratorFramework client) { try { ConfigurationsUtils.updateConfigsFromZookeeper(getConfigurations(), client); } catch (KeeperException.NoNodeException nne) { LOG.warn("No current global configs in zookeeper, but the cache should load lazily..."); } catch(Exception e) { LOG.warn("Unable to load global configs from zookeeper, but the cache should load lazily...", e); } try { ProfilerConfig config = readFromZookeeper(client); if(config != null) { getConfigurations().updateProfilerConfig(config); } } catch (KeeperException.NoNodeException nne) { LOG.warn("No current profiler configs in zookeeper, but the cache should load lazily..."); } catch (Exception e) { LOG.warn("Unable to load profiler configs from zookeeper, but the cache should load lazily...", e); } }