From 2da62bc07d8ec56f15adb2c4128bf02fabb3885c Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Tue, 01 Jul 2014 08:57:03 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1471 File based changelog : improve cursor behavior CR-3911
---
opends/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java b/opends/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java
index 05e93cd..6970a9e 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java
+++ b/opends/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<T> 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