From 2d99dd7e2843c998a2d15f072cb827f443a79809 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Wed, 23 Sep 2026 07:39:43 +0000
Subject: [PATCH] [#1014] Report a ReplicaOfflineMsg as forwarded only to a peer which can decode it (#1019)

---
 opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicationMsg.java |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicationMsg.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicationMsg.java
index bb0f2bd..ce75fe6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicationMsg.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicationMsg.java
@@ -13,6 +13,7 @@
  *
  * Copyright 2006-2010 Sun Microsystems, Inc.
  * Portions copyright 2013-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
  */
 package org.opends.server.replication.protocol;
 
@@ -109,6 +110,25 @@
   public abstract byte[] getBytes(short protocolVersion);
 
   /**
+   * Whether this message has an encoding for a peer which negotiated the
+   * provided replication protocol version.
+   * <p>
+   * A message which has none is dropped by {@link Session#publish(ReplicationMsg)}
+   * - its {@link #getBytes(short)} returns <code>null</code> - with nothing on
+   * the wire and nothing in the log, so a caller which goes on to report what
+   * the peer was told must ask this before it publishes.
+   *
+   * @param protocolVersion
+   *          The protocol version negotiated with the peer.
+   * @return <code>true</code> if this message can be encoded for that version,
+   *         <code>false</code> if it has no encoding for it at all.
+   */
+  public boolean isEncodableFor(short protocolVersion)
+  {
+    return true;
+  }
+
+  /**
    * Generates a ReplicationMsg from its encoded form. This un-serialization is
    * done taking into account the various supported replication protocol
    * versions.

--
Gitblit v1.10.0