Search in sources :

Example 1 with ProducerCreated

use of org.opendaylight.controller.cluster.sharding.messages.ProducerCreated in project controller by opendaylight.

the class DistributedShardedDOMDataTree method createProducer.

@Nonnull
@Override
public DOMDataTreeProducer createProducer(@Nonnull final Collection<DOMDataTreeIdentifier> subtrees) {
    LOG.debug("{} - Creating producer for {}", memberName, subtrees);
    final DOMDataTreeProducer producer = shardedDOMDataTree.createProducer(subtrees);
    final Object response = distributedConfigDatastore.getActorContext().executeOperation(shardedDataTreeActor, new ProducerCreated(subtrees));
    if (response == null) {
        LOG.debug("{} - Received success from remote nodes, creating producer:{}", memberName, subtrees);
        return new ProxyProducer(producer, subtrees, shardedDataTreeActor, distributedConfigDatastore.getActorContext(), shards);
    }
    closeProducer(producer);
    if (response instanceof Throwable) {
        Throwables.throwIfUnchecked((Throwable) response);
        throw new RuntimeException((Throwable) response);
    }
    throw new RuntimeException("Unexpected response to create producer received." + response);
}
Also used : ProducerCreated(org.opendaylight.controller.cluster.sharding.messages.ProducerCreated) ForwardingObject(com.google.common.collect.ForwardingObject) DOMDataTreeProducer(org.opendaylight.mdsal.dom.api.DOMDataTreeProducer) Nonnull(javax.annotation.Nonnull)

Aggregations

ForwardingObject (com.google.common.collect.ForwardingObject)1 Nonnull (javax.annotation.Nonnull)1 ProducerCreated (org.opendaylight.controller.cluster.sharding.messages.ProducerCreated)1 DOMDataTreeProducer (org.opendaylight.mdsal.dom.api.DOMDataTreeProducer)1