BUG-5280: Remove PeristentMessages
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardDataTreeChangeListenerPublisherActorProxy.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.datastore;
9
10 import akka.actor.ActorContext;
11 import javax.annotation.concurrent.NotThreadSafe;
12 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
13 import org.opendaylight.yangtools.concepts.ListenerRegistration;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15
16 /**
17  * Implementation of ShardDataTreeChangeListenerPublisher that offloads the generation and publication
18  * of data tree change notifications to an actor.
19  *
20  * @author Thomas Pantelis
21  */
22 @NotThreadSafe
23 class ShardDataTreeChangeListenerPublisherActorProxy extends AbstractShardDataTreeNotificationPublisherActorProxy
24         implements ShardDataTreeChangeListenerPublisher {
25
26     private final ShardDataTreeChangeListenerPublisher delegatePublisher = new DefaultShardDataTreeChangeListenerPublisher();
27
28     ShardDataTreeChangeListenerPublisherActorProxy(ActorContext actorContext, String actorName) {
29         super(actorContext, actorName);
30     }
31
32     private ShardDataTreeChangeListenerPublisherActorProxy(ShardDataTreeChangeListenerPublisherActorProxy other) {
33         super(other);
34     }
35
36     @Override
37     public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
38             YangInstanceIdentifier treeId, L listener) {
39         return delegatePublisher.registerTreeChangeListener(treeId, listener);
40     }
41
42     @Override
43     public ShardDataTreeChangeListenerPublisher newInstance() {
44         return new ShardDataTreeChangeListenerPublisherActorProxy(this);
45     }
46
47     @Override
48     protected ShardDataTreeNotificationPublisher getDelegatePublisher() {
49         return delegatePublisher;
50     }
51 }