From 7ea8ac48d10e033ba0d6ca0ec0d66ace144062a0 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 07 Jul 2014 15:29:48 +0000
Subject: [PATCH] OPENDJ-1453 Replica offline messages should be synced with updates

---
 opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java b/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java
index f451cab..705a9a2 100644
--- a/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java
+++ b/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java
@@ -26,7 +26,10 @@
  */
 package org.opends.server.replication.common;
 
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.TreeMap;
@@ -168,7 +171,31 @@
   }
 
   /**
+   * Returns a snapshot of this object.
+   *
+   * @return an unmodifiable Map representing a snapshot of this object.
+   */
+  public Map<DN, List<CSN>> getSnapshot()
+  {
+    if (list.isEmpty())
+    {
+      return Collections.emptyMap();
+    }
+    final Map<DN, List<CSN>> map = new HashMap<DN, List<CSN>>();
+    for (Entry<DN, ServerState> entry : list.entrySet())
+    {
+      final List<CSN> l = entry.getValue().getSnapshot();
+      if (!l.isEmpty())
+      {
+        map.put(entry.getKey(), l);
+      }
+    }
+    return Collections.unmodifiableMap(map);
+  }
+
+  /**
    * Returns a string representation of this object.
+   *
    * @return The string representation.
    */
   @Override

--
Gitblit v1.10.0