Merge "Fixed for bug 1168 : Issue while update subnet"
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / impl / GlobalRpcRegistration.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 package org.opendaylight.controller.sal.dom.broker.impl;
9
10 import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
11 import org.opendaylight.controller.sal.core.api.RpcImplementation;
12 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
13 import org.opendaylight.yangtools.yang.common.QName;
14
15 class GlobalRpcRegistration extends AbstractObjectRegistration<RpcImplementation> implements
16         RpcRegistration {
17     private final QName type;
18     private SchemaAwareRpcBroker router;
19
20     public GlobalRpcRegistration(final QName type, final RpcImplementation instance, final SchemaAwareRpcBroker router) {
21         super(instance);
22         this.type = type;
23         this.router = router;
24     }
25
26     @Override
27     public QName getType() {
28         return type;
29     }
30
31     @Override
32     protected void removeRegistration() {
33         if (router != null) {
34             router.remove(this);
35             router = null;
36         }
37     }
38 }