From f370207cb8fe0ad9c458be62acfe9d3e4fb10d21 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 11 Dec 2009 16:55:17 +0000
Subject: [PATCH] Fix for issue 4398 (status can be very slow: include a refresh mode)
---
opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java b/opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
index f19eca6..98f3b54 100644
--- a/opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
+++ b/opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
@@ -41,6 +41,7 @@
import org.opends.server.util.args.Argument;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
+import org.opends.server.util.args.IntegerArgument;
import org.opends.server.util.args.StringArgument;
/**
@@ -55,6 +56,11 @@
// This CLI is always using the administration connector with SSL
private final boolean alwaysSSL = true;
+
+ /**
+ * The 'refresh' argument.
+ */
+ private IntegerArgument refreshArg;
/**
* The 'scriptFriendly' argument.
*/
@@ -120,6 +126,12 @@
setNoPropertiesFileArgument(noPropertiesFileArgument);
initializeGlobalArguments(defaultArgs);
+
+ refreshArg = new IntegerArgument("refresh", 'r',
+ "refresh", false, true, INFO_PERIOD_PLACEHOLDER.get(),
+ true, 1, false, Integer.MAX_VALUE,
+ INFO_DESCRIPTION_REFRESH_PERIOD.get());
+ addGlobalArgument(refreshArg, ioArgGroup);
}
/**
@@ -155,6 +167,33 @@
}
/**
+ * Returns the refresh period (in seconds) specified in the command-line.
+ * If no refresh period was specified, returns -1.
+ * The code assumes that the attributes have been successfully parsed.
+ * @return the specified refresh period in the command-line.
+ */
+ public int getRefreshPeriod()
+ {
+ if (refreshArg.isPresent())
+ {
+ try
+ {
+ return refreshArg.getIntValue();
+ }
+ catch (ArgumentException ae)
+ {
+ // Bug
+ throw new IllegalStateException("Error getting value, this method "+
+ "should be called after parsing the attributes: "+ae, ae);
+ }
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ /**
* Returns the bind DN explicitly provided in the command-line.
* @return the bind DN explicitly provided in the command-line.
* Returns <CODE>null</CODE> if no bind DN was explicitly provided.
--
Gitblit v1.10.0