use of org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver in project bboxdb by jnidzwetzki.
the class TupleStoreConfigurationCache method getDuplicateResolverForTupleStore.
public synchronized DuplicateResolver<Tuple> getDuplicateResolverForTupleStore(final String tupleStorename) {
if (!cache.containsKey(tupleStorename)) {
try {
final TupleStoreAdapter tupleStoreAdapter = ZookeeperClientFactory.getZookeeperClient().getTupleStoreAdapter();
final TupleStoreName tupleStoreNameObject = new TupleStoreName(tupleStorename);
if (!tupleStoreAdapter.isTableKnown(tupleStoreNameObject)) {
logger.error("Table {} is not known, using do nothing duplicate resolver", tupleStorename);
return new DoNothingDuplicateResolver();
}
final TupleStoreConfiguration tupleStoreConfiguration = tupleStoreAdapter.readTuplestoreConfiguration(tupleStoreNameObject);
final DuplicateResolver<Tuple> resolver = TupleDuplicateResolverFactory.build(tupleStoreConfiguration);
cache.put(tupleStorename, resolver);
} catch (ZookeeperException e) {
logger.error("Exception while reading zookeeper data", e);
return new DoNothingDuplicateResolver();
}
}
final DuplicateResolver<Tuple> duplicateResolver = cache.get(tupleStorename);
return duplicateResolver;
}
Aggregations