From bcf686add35bda4a6ac5c3d085abe151ea018e8e Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 14 Jan 2009 08:29:50 +0000
Subject: [PATCH]
---
opends/src/server/org/opends/server/replication/plugin/PendingChanges.java | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 54 insertions(+), 1 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/plugin/PendingChanges.java b/opends/src/server/org/opends/server/replication/plugin/PendingChanges.java
index b9b512f..ad1207d 100644
--- a/opends/src/server/org/opends/server/replication/plugin/PendingChanges.java
+++ b/opends/src/server/org/opends/server/replication/plugin/PendingChanges.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2009 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -113,6 +113,18 @@
public synchronized void commit(ChangeNumber changeNumber,
LDAPUpdateMsg msg)
{
+ _commit(changeNumber, msg);
+ }
+ /**
+ * Mark an update message as committed.
+ *
+ * @param changeNumber The ChangeNumber of the update message that must be
+ * set as committed.
+ * @param msg The message associated to the update.
+ */
+ public void _commit(ChangeNumber changeNumber,
+ LDAPUpdateMsg msg)
+ {
PendingChange curChange = pendingChanges.get(changeNumber);
if (curChange == null)
{
@@ -149,6 +161,18 @@
*/
public synchronized ChangeNumber putLocalOperation(PluginOperation operation)
{
+ return _putLocalOperation(operation);
+ }
+ /**
+ * Add a new UpdateMsg to the pending list from the provided local
+ * operation.
+ *
+ * @param operation The local operation for which an UpdateMsg must
+ * be added in the pending list.
+ * @return The ChangeNumber now associated to the operation.
+ */
+ public ChangeNumber _putLocalOperation(PluginOperation operation)
+ {
ChangeNumber changeNumber;
changeNumber = changeNumberGenerator.newChangeNumber();
@@ -165,6 +189,15 @@
*/
public synchronized int pushCommittedChanges()
{
+ return _pushCommittedChanges();
+ }
+ /**
+ * Push all committed local changes to the replicationServer service.
+ *
+ * @return The number of pushed updates.
+ */
+ public int _pushCommittedChanges()
+ {
int numSentUpdates = 0;
if (pendingChanges.isEmpty())
return numSentUpdates;
@@ -195,4 +228,24 @@
}
return numSentUpdates;
}
+
+ /**
+ * Mark an update message as committed, then
+ * push all committed local changes to the replicationServer service
+ * in a single atomic operation.
+ *
+ *
+ * @param changeNumber The ChangeNumber of the update message that must be
+ * set as committed.
+ * @param msg The message associated to the update.
+ *
+ * @return The number of pushed updates.
+ */
+ public synchronized int commitAndPushCommittedChanges(
+ ChangeNumber changeNumber,
+ LDAPUpdateMsg msg)
+ {
+ _commit(changeNumber, msg);
+ return _pushCommittedChanges();
+ }
}
--
Gitblit v1.10.0