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 static java.util.Objects.requireNonNull;
12 import com.google.common.base.MoreObjects.ToStringHelper;
13 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener;
14 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListenerRegistration;
15 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
18 * Implementation of EntityOwnershipListenerRegistration.
20 * @author Thomas Pantelis
22 class DistributedEntityOwnershipListenerRegistration extends AbstractObjectRegistration<DOMEntityOwnershipListener>
23 implements DOMEntityOwnershipListenerRegistration {
24 private final DistributedEntityOwnershipService service;
25 private final String entityType;
27 DistributedEntityOwnershipListenerRegistration(final DOMEntityOwnershipListener listener, final String entityType,
28 final DistributedEntityOwnershipService service) {
30 this.entityType = requireNonNull(entityType, "entityType cannot be null");
31 this.service = requireNonNull(service, "DOMEntityOwnershipListener cannot be null");
35 protected void removeRegistration() {
36 service.unregisterListener(getEntityType(), getInstance());
40 public String getEntityType() {
45 protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
46 return toStringHelper.add("entityType", entityType);