From 4fd152ec8ba98ac9a70202dbac2b3a579df1033a Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 10 Jun 2013 14:25:54 +0000
Subject: [PATCH] Fix OPENDJ-951: Reduce size and frequency of replication MonitorMsg
---
opends/src/server/org/opends/server/replication/common/ServerState.java | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/common/ServerState.java b/opends/src/server/org/opends/server/replication/common/ServerState.java
index 92bf8d1..e9963fa 100644
--- a/opends/src/server/org/opends/server/replication/common/ServerState.java
+++ b/opends/src/server/org/opends/server/replication/common/ServerState.java
@@ -27,6 +27,7 @@
*/
package org.opends.server.replication.common;
+import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
@@ -37,6 +38,8 @@
import java.util.Set;
import java.util.zip.DataFormatException;
+import org.opends.server.protocols.asn1.ASN1Writer;
+import org.opends.server.replication.protocol.ProtocolVersion;
import org.opends.server.types.ByteString;
@@ -278,6 +281,41 @@
}
return values;
}
+
+
+
+ /**
+ * Encodes this server state to the provided ASN1 writer.
+ *
+ * @param writer
+ * The ASN1 writer.
+ * @param protocolVersion
+ * The replication protocol version.
+ * @throws IOException
+ * If an error occurred during encoding.
+ */
+ public void writeTo(ASN1Writer writer, short protocolVersion)
+ throws IOException
+ {
+ synchronized (list)
+ {
+ if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V7)
+ {
+ for (ChangeNumber cn : list.values())
+ {
+ writer.writeOctetString(cn.toByteString());
+ }
+ }
+ else
+ {
+ for (ChangeNumber cn : list.values())
+ {
+ writer.writeOctetString(cn.toString());
+ }
+ }
+ }
+ }
+
/**
* Return the text representation of ServerState.
* @return the text representation of ServerState
--
Gitblit v1.10.0