2 * Copyright (c) 2015 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.entityownership;
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener;
12 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListenerRegistration;
13 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
16 * Implementation of EntityOwnershipListenerRegistration.
18 * @author Thomas Pantelis
20 class DistributedEntityOwnershipListenerRegistration extends AbstractObjectRegistration<DOMEntityOwnershipListener>
21 implements DOMEntityOwnershipListenerRegistration {
22 private final DistributedEntityOwnershipService service;
23 private final String entityType;
25 DistributedEntityOwnershipListenerRegistration(DOMEntityOwnershipListener listener, String entityType,
26 DistributedEntityOwnershipService service) {
28 this.entityType = Preconditions.checkNotNull(entityType, "entityType cannot be null");
29 this.service = Preconditions.checkNotNull(service, "DOMEntityOwnershipListener cannot be null");
33 protected void removeRegistration() {
34 service.unregisterListener(getEntityType(), getInstance());
38 public String getEntityType() {
43 public String toString() {
44 return "DistributedEntityOwnershipListenerRegistration [entityType=" + getEntityType()
45 + ", listener=" + getInstance() + "]";