From 7645fcf6334c7c78655a12a08b4a8f3351be1ba4 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 30 Apr 2014 13:19:59 +0000
Subject: [PATCH] OPENDJ-1448 Remove JReplicaDB flushing thread and msg queue
---
opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java | 34 ++++++++++++++--------------------
1 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java b/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
index ec3918d..1e30b8e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
@@ -29,7 +29,6 @@
import java.io.Closeable;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import java.io.UnsupportedEncodingException;
-import java.util.List;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -183,15 +182,14 @@
}
/**
- * add a list of changes to the underlying db.
+ * add one change to the underlying db.
*
- * @param changes
- * The list of changes to add to the underlying db.
- * @return the total size of all the changes
+ * @param change
+ * The change to add to the underlying db.
* @throws ChangelogException
* If a database problem happened
*/
- public int addEntries(List<UpdateMsg> changes) throws ChangelogException
+ public void addEntry(UpdateMsg change) throws ChangelogException
{
dbCloseLock.readLock().lock();
try
@@ -199,26 +197,22 @@
// If the DB has been closed then return immediately.
if (isDBClosed())
{
- return 0;
+ return;
}
- int totalSize = 0;
- for (UpdateMsg change : changes)
- {
- final DatabaseEntry key = createReplicationKey(change.getCSN());
- final DatabaseEntry data = new ReplicationData(change);
+ final DatabaseEntry key = createReplicationKey(change.getCSN());
+ final DatabaseEntry data = new ReplicationData(change);
- insertCounterRecordIfNeeded(change.getCSN());
- db.put(null, key, data);
- counterCurrValue++;
-
- totalSize += change.size();
- }
- return totalSize;
+ insertCounterRecordIfNeeded(change.getCSN());
+ db.put(null, key, data);
+ counterCurrValue++;
}
catch (DatabaseException e)
{
- throw new ChangelogException(e);
+ throw new ChangelogException(
+ ERR_EXCEPTION_COULD_NOT_ADD_CHANGE_TO_REPLICA_DB.get(
+ change.toString(), String.valueOf(baseDN),
+ String.valueOf(serverId), stackTraceToSingleLineString(e)));
}
finally
{
--
Gitblit v1.10.0