BUG 2221 : Add metering to ShardTransaction actor
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / NoOpDataChangeListenerRegistration.java
1 /*
2  * Copyright (c) 2014 Cisco 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
9 package org.opendaylight.controller.cluster.datastore;
10
11 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
12 import org.opendaylight.yangtools.concepts.ListenerRegistration;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15
16 /**
17  * When a consumer registers a data change listener and no local shard is
18  * available to register that listener with then we return an instance of
19  * NoOpDataChangeListenerRegistration
20  *
21  * <p>
22  *
23  * The NoOpDataChangeListenerRegistration as it's name suggests does
24  * nothing when an operation is invoked on it
25  */
26 public class NoOpDataChangeListenerRegistration
27     implements ListenerRegistration {
28
29     private final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>
30         listener;
31
32     public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> NoOpDataChangeListenerRegistration(
33         AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener) {
34
35         this.listener = listener;
36     }
37
38     @Override
39     public AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> getInstance() {
40         return listener;
41     }
42
43     @Override public void close() {
44
45     }
46 }