Bug4105: Implement DistributedEntityOwnershipService#registerCandidate
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / clustering / CandidateAlreadyRegisteredException.java
index f509b4002b95e092dfb4808d5921f7d6539dafe8..7e35bc9439a134780c9b8e8a617c07eb0aa5166a 100644 (file)
@@ -16,25 +16,18 @@ 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 static final long serialVersionUID = 1L;
+
     private final Entity entity;
     private final EntityOwnershipCandidate registeredCandidate;
 
     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");
-    }
-
-    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");
+                                               @Nonnull EntityOwnershipCandidate registeredCandidate) {
+        super(String.format("Candidate %s has already been registered for %s",
+                Preconditions.checkNotNull(registeredCandidate, "registeredCandidate should not be null"),
+                Preconditions.checkNotNull(entity, "entity should not be null")));
+        this.entity = entity;
+        this.registeredCandidate = registeredCandidate;
     }
 
     /**