Search in sources :

Example 11 with DoNothingDuplicateResolver

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;
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) TupleStoreAdapter(org.bboxdb.distribution.zookeeper.TupleStoreAdapter) DoNothingDuplicateResolver(org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) Tuple(org.bboxdb.storage.entity.Tuple)

Aggregations

DoNothingDuplicateResolver (org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver)11 NetworkOperationFuture (org.bboxdb.network.client.future.NetworkOperationFuture)9 TupleListFuture (org.bboxdb.network.client.future.TupleListFuture)9 JoinedTupleListFuture (org.bboxdb.network.client.future.JoinedTupleListFuture)8 RoutingHeader (org.bboxdb.network.routing.RoutingHeader)8 ArrayList (java.util.ArrayList)5 List (java.util.List)4 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)4 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)4 RoutingHop (org.bboxdb.network.routing.RoutingHop)4 BBoxDBException (org.bboxdb.misc.BBoxDBException)3 Tuple (org.bboxdb.storage.entity.Tuple)2 Test (org.junit.Test)2 TupleStoreAdapter (org.bboxdb.distribution.zookeeper.TupleStoreAdapter)1 ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)1 BBoxDBConnection (org.bboxdb.network.client.BBoxDBConnection)1 TupleListFutureStore (org.bboxdb.network.client.tools.TupleListFutureStore)1 NetworkRequestPackage (org.bboxdb.network.packages.NetworkRequestPackage)1 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)1 JoinedTuple (org.bboxdb.storage.entity.JoinedTuple)1