use of org.bboxdb.commons.InputParseException in project bboxdb by jnidzwetzki.
the class DistributionGroupConfigurationCache method getDistributionGroupConfiguration.
/**
* Get the distribution group configuration
* @param distributionGroupName
* @return
* @throws ZookeeperNotFoundException
*/
public synchronized DistributionGroupConfiguration getDistributionGroupConfiguration(final String distributionGroupName) throws ZookeeperNotFoundException {
if (!cache.containsKey(distributionGroupName)) {
try {
final ZookeeperClient zookeeperClient = ZookeeperClientFactory.getZookeeperClient();
final DistributionGroupAdapter distributionGroupZookeeperAdapter = new DistributionGroupAdapter(zookeeperClient);
final DistributionGroupConfiguration configuration = distributionGroupZookeeperAdapter.getDistributionGroupConfiguration(distributionGroupName);
addNewConfiguration(distributionGroupName, configuration);
} catch (InputParseException | ZookeeperException e) {
logger.error("Exception while reading zokeeper data", e);
return new DistributionGroupConfiguration();
}
}
return cache.get(distributionGroupName);
}
use of org.bboxdb.commons.InputParseException in project bboxdb by jnidzwetzki.
the class DistributionRegionAdapter method processStatistics.
/**
* @param result
* @param statisticsPath
* @param childs
* @throws ZookeeperException
*/
private void processStatistics(final Map<BBoxDBInstance, Map<String, Long>> result, final String statisticsPath, final List<String> childs) throws ZookeeperException {
for (final String system : childs) {
final String path = statisticsPath + "/" + system;
final Map<String, Long> systemMap = new HashMap<>();
try {
final String sizePath = path + "/" + ZookeeperNodeNames.NAME_STATISTICS_TOTAL_SIZE;
if (zookeeperClient.exists(sizePath)) {
final String sizeString = zookeeperClient.readPathAndReturnString(sizePath);
final long size = MathUtil.tryParseLong(sizeString, () -> "Unable to parse " + sizeString);
systemMap.put(ZookeeperNodeNames.NAME_STATISTICS_TOTAL_SIZE, size);
}
final String tuplePath = path + "/" + ZookeeperNodeNames.NAME_STATISTICS_TOTAL_TUPLES;
if (zookeeperClient.exists(tuplePath)) {
final String tuplesString = zookeeperClient.readPathAndReturnString(tuplePath);
final long tuples = MathUtil.tryParseLong(tuplesString, () -> "Unable to parse " + tuplesString);
systemMap.put(ZookeeperNodeNames.NAME_STATISTICS_TOTAL_TUPLES, tuples);
}
result.put(new BBoxDBInstance(system), systemMap);
} catch (InputParseException | ZookeeperNotFoundException e) {
logger.error("Unable to read statistics", e);
}
}
}
Aggregations