Allow AbstractClientActor generation to start from non-zero
[controller.git] / opendaylight / md-sal / cds-access-client / src / main / java / org / opendaylight / controller / cluster / access / client / ConnectionEntry.java
index 64586f05ee9943382c9c10361a84915a06c868be..b47ddee2a3c5707624ca78b11579a0a3e9894473 100644 (file)
@@ -7,8 +7,11 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
 import java.util.function.Consumer;
 import org.opendaylight.controller.cluster.access.concepts.Request;
 import org.opendaylight.controller.cluster.access.concepts.Response;
@@ -27,8 +30,8 @@ public class ConnectionEntry implements Immutable {
     private final long enqueuedTicks;
 
     ConnectionEntry(final Request<?, ?> request, final Consumer<Response<?, ?>> callback, final long now) {
-        this.request = Preconditions.checkNotNull(request);
-        this.callback = Preconditions.checkNotNull(callback);
+        this.request = requireNonNull(request);
+        this.callback = requireNonNull(callback);
         this.enqueuedTicks = now;
     }
 
@@ -48,7 +51,16 @@ public class ConnectionEntry implements Immutable {
         callback.accept(response);
     }
 
-    final long getEnqueuedTicks() {
+    public final long getEnqueuedTicks() {
         return enqueuedTicks;
     }
+
+    @Override
+    public final String toString() {
+        return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
+    }
+
+    ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
+        return toStringHelper.add("request", request).add("enqueuedTicks", enqueuedTicks);
+    }
 }