From 3ee70c76e7e5c1cfb8c5ce16bc3f50f2306bdee7 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Mon, 18 Aug 2014 11:00:35 +0000
Subject: [PATCH] Forward port of checkpoint commit for OPENDJ-1471 File based changelog : improve cursor behavior

---
 opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java b/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java
index 05e93cd..6970a9e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java
@@ -21,7 +21,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2013 ForgeRock AS
+ *      Copyright 2013-2014 ForgeRock AS
  */
 package org.opends.server.replication.server.changelog.api;
 
@@ -32,15 +32,23 @@
  * anymore, a cursor must be closed to release all the resources into the
  * database.
  * <p>
- * Here is a typical usage pattern:
- *
+ * The cursor provides a java.sql.ResultSet like API : it is positioned before
+ * the first requested record and needs to be moved forward by calling
+ * {@link DBCursor#next()}.
+ * <p>
+ * Usage:
  * <pre>
- * DBCursor&lt;T&gt; cursor = ...;         // obtain a new cursor,
- *                                   // already initialized
- * T record1 = cursor.getRecord();   // get the first record
- * while (cursor.next()) {           // advance to the next record
- *   T record = cursor.getRecord();  // get the next record
- *   ...                             // etc.
+ * {@code
+ *  DBCursor cursor = ...;
+ *  try {
+ *    while (cursor.next()) {
+ *      Record record = cursor.getRecord();
+ *      // ... can call cursor.getRecord() again: it will return the same result
+ *    }
+ *  }
+ *  finally {
+ *    close(cursor);
+ *  }
  * }
  * </pre>
  *

--
Gitblit v1.10.0