BUG-5280: separate request sequence and transmit sequence
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / Message.java
index 87b0e6ef345d8ad0c142fd6259d0ab0b1a5f2b67..30e631eed7b0e9f46ba5e5fd2a72e985d9981233 100644 (file)
@@ -50,28 +50,23 @@ import org.opendaylight.yangtools.concepts.WritableIdentifier;
 public abstract class Message<T extends WritableIdentifier, C extends Message<T, C>> implements Immutable,
         Serializable {
     private static final long serialVersionUID = 1L;
-    private final T target;
-    private final long sequence;
+
     private final ABIVersion version;
-    private final long retry;
+    private final long sequence;
+    private final T target;
 
-    private Message(final ABIVersion version, final T target, final long sequence, final long retry) {
+    private Message(final ABIVersion version, final T target, final long sequence) {
         this.target = Preconditions.checkNotNull(target);
         this.version = Preconditions.checkNotNull(version);
         this.sequence = sequence;
-        this.retry = retry;
     }
 
-    Message(final T target, final long sequence, final long retry) {
-        this(ABIVersion.current(), target, sequence, retry);
+    Message(final T target, final long sequence) {
+        this(ABIVersion.current(), target, sequence);
     }
 
     Message(final C msg, final ABIVersion version) {
-        this(version, msg.getTarget(), msg.getSequence(), msg.getRetry());
-    }
-
-    Message(final C msg, final long retry) {
-        this(msg.getVersion(), msg.getTarget(), msg.getSequence(), retry);
+        this(version, msg.getTarget(), msg.getSequence());
     }
 
     /**
@@ -84,28 +79,19 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
     }
 
     /**
-     * Get the message sequence of this message.
+     * Get the logical sequence number.
      *
-     * @return Message sequence
+     * @return logical sequence number
      */
     public final long getSequence() {
         return sequence;
     }
 
     @VisibleForTesting
-    public final ABIVersion getVersion() {
+    public final @Nonnull ABIVersion getVersion() {
         return version;
     }
 
-    /**
-     * Get the message retry counter.
-     *
-     * @return Retry counter
-     */
-    public final long getRetry() {
-        return retry;
-    }
-
     /**
      * Return a message which will end up being serialized in the specified {@link ABIVersion}.
      *
@@ -141,24 +127,6 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
      */
     protected abstract @Nonnull C cloneAsVersion(@Nonnull ABIVersion version);
 
-    /**
-     * Return a message which will have the retry counter incremented by one.
-     *
-     * @return A message with the specified retry counter
-     */
-    public final @Nonnull C incrementRetry() {
-        return Verify.verifyNotNull(cloneAsRetry(retry +1));
-    }
-
-    /**
-     * Create a copy of this message which will have its retry count bumped. This method should be implemented by
-     * the concrete final message class and should invoked the equivalent of {@link #Message(Message, long)}.
-     *
-     * @param retry new retry count
-     * @return A message with the specified retry counter
-     */
-    protected abstract @Nonnull C cloneAsRetry(long retry);
-
     @Override
     public final String toString() {
         return addToStringAttributes(MoreObjects.toStringHelper(this).omitNullValues()).toString();
@@ -173,7 +141,7 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
      * @throws NullPointerException if toStringHelper is null
      */
     protected @Nonnull ToStringHelper addToStringAttributes(final @Nonnull ToStringHelper toStringHelper) {
-        return toStringHelper.add("target", target).add("sequence", Long.toUnsignedString(sequence, 16));
+        return toStringHelper.add("target", target).add("sequence", Long.toUnsignedString(sequence));
     }
 
     /**