- private static BiMap<DOMDataTreeIdentifier, DOMDataTreeShardProducer> mapIdsToProducer(
- final Multimap<DOMDataTreeShard, DOMDataTreeIdentifier> shardToId) {
- final Builder<DOMDataTreeIdentifier, DOMDataTreeShardProducer> idToProducerBuilder = ImmutableBiMap.builder();
- for (final Entry<DOMDataTreeShard, Collection<DOMDataTreeIdentifier>> entry : shardToId.asMap().entrySet()) {
- if (entry.getKey() instanceof WriteableDOMDataTreeShard) {
- //create a single producer for all prefixes in a single shard
- final DOMDataTreeShardProducer producer = ((WriteableDOMDataTreeShard) entry.getKey())
- .createProducer(entry.getValue());
- // id mapped to producers
- for (final DOMDataTreeIdentifier id : entry.getValue()) {
- idToProducerBuilder.put(id, producer);
- }
- } else {
- LOG.error("Unable to create a producer for shard that's not a WriteableDOMDataTreeShard");
- }
- }