From 26ff1f0755680cbce7b5bdb136750b2b1bc9e4ed Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 10 Nov 2006 08:05:56 +0000
Subject: [PATCH] issue 508 These changes implement a window mechanism in the sycnhronization protocol.
---
opends/src/server/org/opends/server/synchronization/SynchronizationMonitor.java | 86 ++++++++++++++++++++-----------------------
1 files changed, 40 insertions(+), 46 deletions(-)
diff --git a/opends/src/server/org/opends/server/synchronization/SynchronizationMonitor.java b/opends/src/server/org/opends/server/synchronization/SynchronizationMonitor.java
index f25a05d..c59ecec 100644
--- a/opends/src/server/org/opends/server/synchronization/SynchronizationMonitor.java
+++ b/opends/src/server/org/opends/server/synchronization/SynchronizationMonitor.java
@@ -98,64 +98,37 @@
attributes.add(attr);
/* get number of received updates */
- final String ATTR_UPDATE_RECVD = "received-updates";
- AttributeType type =
- DirectoryServer.getDefaultAttributeType(ATTR_UPDATE_RECVD);
- LinkedHashSet<AttributeValue> values = new LinkedHashSet<AttributeValue>();
- values.add(new AttributeValue(type,
- String.valueOf(domain.getNumRcvdUpdates())));
- attr = new Attribute(type, "received-updates", values);
- attributes.add(attr);
+ addMonitorData(attributes, "received-updates", domain.getNumRcvdUpdates());
/* get number of updates sent */
- final String ATTR_UPDATE_SENT = "sent-updates";
- type = DirectoryServer.getDefaultAttributeType(ATTR_UPDATE_SENT);
- values = new LinkedHashSet<AttributeValue>();
- values.add(new AttributeValue(type,
- String.valueOf(domain.getNumSentUpdates())));
- attr = new Attribute(type, "sent-updates", values);
- attributes.add(attr);
+ addMonitorData(attributes, "sent-updates", domain.getNumSentUpdates());
/* get number of changes in the pending list */
- final String ATTR_UPDATE_PENDING = "pending-updates";
- type = DirectoryServer.getDefaultAttributeType(ATTR_UPDATE_PENDING);
- values = new LinkedHashSet<AttributeValue>();
- values.add(new AttributeValue(type,
- String.valueOf(domain.getPendingUpdatesCount())));
- attr = new Attribute(type, "pending-updates", values);
- attributes.add(attr);
+ addMonitorData(attributes, "pending-updates",
+ domain.getPendingUpdatesCount());
/* get number of changes replayed */
- final String ATTR_REPLAYED_UPDATE = "replayed-updates";
- type = DirectoryServer.getDefaultAttributeType(ATTR_REPLAYED_UPDATE);
- values = new LinkedHashSet<AttributeValue>();
- values.add(new AttributeValue(type,
- String.valueOf(domain.getNumProcessedUpdates())));
- attr = new Attribute(type, ATTR_REPLAYED_UPDATE, values);
- attributes.add(attr);
+ addMonitorData(attributes, "replayed-updates",
+ domain.getNumProcessedUpdates());
/* get number of changes successfully */
- final String ATTR_REPLAYED_UPDATE_OK = "replayed-updates-ok";
- type = DirectoryServer.getDefaultAttributeType(ATTR_REPLAYED_UPDATE_OK);
- values = new LinkedHashSet<AttributeValue>();
- values.add(new AttributeValue(type,
- String.valueOf(domain.getNumReplayedPostOpCalled())));
- attr = new Attribute(type, ATTR_REPLAYED_UPDATE_OK, values);
- attributes.add(attr);
+ addMonitorData(attributes, "replayed-updates-ok",
+ domain.getNumReplayedPostOpCalled());
- /* get debugCount */
- final String DEBUG_COUNT = "debug-count";
- type = DirectoryServer.getDefaultAttributeType(DEBUG_COUNT);
- values = new LinkedHashSet<AttributeValue>();
- values.add(new AttributeValue(type,
- String.valueOf(domain.getDebugCount())));
- attr = new Attribute(type, DEBUG_COUNT, values);
- attributes.add(attr);
+ /* get window information */
+ addMonitorData(attributes, "max-rcv-window", domain.getMaxRcvWindow());
+ addMonitorData(attributes, "current-rcv-window",
+ domain.getCurrentRcvWindow());
+ addMonitorData(attributes, "max-send-window",
+ domain.getMaxSendWindow());
+ addMonitorData(attributes, "current-send-window",
+ domain.getCurrentSendWindow());
/* get the Server State */
final String ATTR_SERVER_STATE = "server-state";
- type = DirectoryServer.getDefaultAttributeType(ATTR_SERVER_STATE);
- values = new LinkedHashSet<AttributeValue>();
+ AttributeType type =
+ DirectoryServer.getDefaultAttributeType(ATTR_SERVER_STATE);
+ LinkedHashSet<AttributeValue> values = new LinkedHashSet<AttributeValue>();
for (String str : domain.getServerState().toStringSet())
{
values.add(new AttributeValue(type,str));
@@ -168,6 +141,27 @@
}
/**
+ * Add an attribute with an integer value to the list of monitoring
+ * attributes.
+ *
+ * @param attributes the list of monitoring attributes
+ * @param name the name of the attribute to add.
+ * @param value The integer value of he attribute to add.
+ */
+ private void addMonitorData(ArrayList<Attribute> attributes,
+ String name, int value)
+ {
+ Attribute attr;
+ AttributeType type;
+ LinkedHashSet<AttributeValue> values;
+ type = DirectoryServer.getDefaultAttributeType(name);
+ values = new LinkedHashSet<AttributeValue>();
+ values.add(new AttributeValue(type, String.valueOf(value)));
+ attr = new Attribute(type, name, values);
+ attributes.add(attr);
+ }
+
+ /**
* Retrieves the length of time in milliseconds that should elapse between
* calls to the <CODE>updateMonitorData()</CODE> method. A negative or zero
* return value indicates that the <CODE>updateMonitorData()</CODE> method
--
Gitblit v1.10.0