BUG 4615 : Add method on EOS to check if a candidate is registered locally
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / clustering / CandidateAlreadyRegisteredException.java
index f509b4002b95e092dfb4808d5921f7d6539dafe8..976688946fa65b34e566ad51022a52b91b313bbb 100644 (file)
@@ -16,25 +16,14 @@ import javax.annotation.Nonnull;
  * duplicate registration or two different components within the same process trying to register a Candidate.
  */
 public class CandidateAlreadyRegisteredException extends Exception {
-    private final Entity entity;
-    private final EntityOwnershipCandidate registeredCandidate;
+    private static final long serialVersionUID = 1L;
 
-    public CandidateAlreadyRegisteredException(@Nonnull Entity entity,
-                                               @Nonnull EntityOwnershipCandidate registeredCandidate,
-                                               String message) {
-        super(message);
-        this.entity = Preconditions.checkNotNull(entity, "entity should not be null");
-        this.registeredCandidate = Preconditions.checkNotNull(registeredCandidate,
-                "registeredCandidate should not be null");
-    }
+    private final Entity entity;
 
-    public CandidateAlreadyRegisteredException(@Nonnull Entity entity,
-                                               @Nonnull EntityOwnershipCandidate registeredCandidate,
-                                               String message, Throwable throwable) {
-        super(message, throwable);
-        this.entity = Preconditions.checkNotNull(entity, "entity should not be null");
-        this.registeredCandidate = Preconditions.checkNotNull(registeredCandidate,
-                "registeredCandidate should not be null");
+    public CandidateAlreadyRegisteredException(@Nonnull Entity entity) {
+        super(String.format("Candidate has already been registered for %s",
+                Preconditions.checkNotNull(entity, "entity should not be null")));
+        this.entity = entity;
     }
 
     /**
@@ -45,13 +34,4 @@ public class CandidateAlreadyRegisteredException extends Exception {
     public Entity getEntity() {
         return entity;
     }
-
-    /**
-     *
-     * @return the currently registered candidate
-     */
-    @Nonnull
-    public EntityOwnershipCandidate getRegisteredCandidate() {
-        return registeredCandidate;
-    }
 }