2 * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore;
10 import akka.actor.Props;
11 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
12 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
15 * Actor used to generate and publish data tree notifications. This is used to offload the potentially
16 * expensive notification generation from the Shard actor.
18 * @author Thomas Pantelis
20 public class ShardDataTreeNotificationPublisherActor extends AbstractUntypedActor {
23 protected void handleReceive(Object message) {
24 if(message instanceof PublishNotifications) {
25 ((PublishNotifications)message).publish();
29 static Props props() {
30 return Props.create(ShardDataTreeNotificationPublisherActor.class);
33 static class PublishNotifications {
34 private final ShardDataTreeNotificationPublisher publisher;
35 private final DataTreeCandidate candidate;
36 private final String logContext;
38 PublishNotifications(ShardDataTreeNotificationPublisher publisher, DataTreeCandidate candidate,
40 this.publisher = publisher;
41 this.candidate = candidate;
42 this.logContext = logContext;
45 private void publish() {
46 publisher.publishChanges(candidate, logContext);