2 * Copyright (c) 2014 Cisco 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
9 package org.opendaylight.controller.cluster.datastore;
11 import akka.actor.ActorSelection;
12 import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistration;
13 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
14 import org.opendaylight.yangtools.concepts.ListenerRegistration;
15 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19 * ListenerRegistrationProxy acts as a proxy for a ListenerRegistration that was done on a remote shard
21 * Registering a DataChangeListener on the Data Store creates a new instance of the ListenerRegistrationProxy
22 * The ListenerRegistrationProxy talks to a remote ListenerRegistration actor.
25 public class DataChangeListenerRegistrationProxy implements ListenerRegistration {
26 private final ActorSelection listenerRegistrationActor;
27 private final AsyncDataChangeListener listener;
29 public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
30 DataChangeListenerRegistrationProxy(
31 ActorSelection listenerRegistrationActor,
33 this.listenerRegistrationActor = listenerRegistrationActor;
34 this.listener = listener;
38 public Object getInstance() {
44 listenerRegistrationActor.tell(new CloseDataChangeListenerRegistration(), null);