From 137d1b4ba1992acdd880b61b1a03dc31f0cc1839 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 23 Apr 2014 14:19:01 +0000
Subject: [PATCH] OPENDJ-1448 Remove JReplicaDB flushing thread and msg queue
---
opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java | 34 ++++++++++++++--------------------
1 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java b/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
index 818fba5..a1dd6ec 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
@@ -28,7 +28,6 @@
import java.io.Closeable;
import java.io.UnsupportedEncodingException;
-import java.util.List;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -182,15 +181,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
@@ -198,26 +196,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