Bug 4992: Removed old leader's candidates on leader change
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / entityownership / DistributedEntityOwnershipCandidateRegistration.java
index 70c454e3afbbc79c90b67669b5025f45a1e3009a..0492cbcc72b6c6a3be7bae1bbc995927aa49a189 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.controller.cluster.datastore.entityownership;
 
 import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidate;
 import org.opendaylight.controller.md.sal.common.impl.clustering.AbstractEntityOwnershipCandidateRegistration;
 
 /**
@@ -19,14 +18,20 @@ import org.opendaylight.controller.md.sal.common.impl.clustering.AbstractEntityO
 class DistributedEntityOwnershipCandidateRegistration extends AbstractEntityOwnershipCandidateRegistration {
     private final DistributedEntityOwnershipService service;
 
-    DistributedEntityOwnershipCandidateRegistration(EntityOwnershipCandidate candidate, Entity entity,
-            DistributedEntityOwnershipService service) {
-        super(candidate, entity);
+    DistributedEntityOwnershipCandidateRegistration(Entity entity, DistributedEntityOwnershipService service) {
+        super(entity);
         this.service = service;
     }
 
     @Override
-    public void close() {
-        service.unregisterCandidate(getEntity());
+    protected void removeRegistration() {
+        service.unregisterCandidate(getInstance());
     }
+
+    @Override
+    public String toString() {
+        return "DistributedEntityOwnershipCandidateRegistration [entity=" + getInstance() + "]";
+    }
+
+
 }