Improve error reporting for tell-based reads
[controller.git] / opendaylight / md-sal / cds-access-client / src / main / java / org / opendaylight / controller / cluster / access / client / BackendInfo.java
index bdffb08c3eb81bf576d3420520db7ef814942013..01aff95532b4bd228afed5fe025531a93fecc1a7 100644 (file)
@@ -17,9 +17,10 @@ import org.opendaylight.controller.cluster.access.ABIVersion;
  * Basic information about how to talk to the backend. ClientActorBehavior uses this information to dispatch requests
  * to the backend.
  *
+ * <p>
  * This class is not final so concrete actor behavior implementations may subclass it and track more information about
  * the backend. The {@link #hashCode()} and {@link #equals(Object)} methods are made final to ensure subclasses compare
- * on identity.
+ * on object identity.
  *
  * @author Robert Varga
  */
@@ -28,10 +29,13 @@ public class BackendInfo {
     private final ActorRef actor;
     private final int maxMessages;
     private final long sessionId;
+    private final String name;
 
-    protected BackendInfo(final ActorRef actor, final long sessionId, final ABIVersion version, final int maxMessages) {
+    protected BackendInfo(final ActorRef actor, final String name, final long sessionId, final ABIVersion version,
+            final int maxMessages) {
         this.version = Preconditions.checkNotNull(version);
         this.actor = Preconditions.checkNotNull(actor);
+        this.name = Preconditions.checkNotNull(name);
         Preconditions.checkArgument(maxMessages > 0, "Maximum messages has to be positive, not %s", maxMessages);
         this.maxMessages = maxMessages;
         this.sessionId = sessionId;
@@ -41,6 +45,10 @@ public class BackendInfo {
         return actor;
     }
 
+    public final String getName() {
+        return name;
+    }
+
     public final ABIVersion getVersion() {
         return version;
     }
@@ -65,7 +73,7 @@ public class BackendInfo {
 
     @Override
     public final String toString() {
-        return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
+        return addToStringAttributes(MoreObjects.toStringHelper(this).omitNullValues()).toString();
     }
 
     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {