From 40e73595cc10ff77df7ffeead6553e9c9722fcc9 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Fri, 24 Aug 2007 21:09:04 +0000
Subject: [PATCH] Added a setter method for the lock manager fair ordering property introduced in revision 2783
---
opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java | 52 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java b/opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java
index ac786c0..44c895a 100644
--- a/opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java
+++ b/opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java
@@ -971,6 +971,48 @@
}
/**
+ * Specifies whether a fair ordering should be used for the lock manager.
+ *
+ * @param fairOrdering True if fair ordering should be used or False
+ * otherwise.
+ *
+ * @return The previously-configured setting for fair ordering. If
+ * there was no previously-configured value, then the
+ * default initial setting will be returned.
+ *
+ * @throws InitializationException If the Directory Server is
+ * already running.
+ */
+ public boolean setLockManagerFairOrdering(boolean fairOrdering)
+ throws InitializationException
+ {
+ if (DirectoryServer.isRunning())
+ {
+ throw new InitializationException(
+ ERR_DIRCFG_SERVER_ALREADY_RUNNING.get());
+ }
+
+ String fairOrderingStr =
+ setProperty(PROPERTY_LOCK_MANAGER_FAIR_ORDERING,
+ String.valueOf(fairOrdering));
+ if (fairOrderingStr == null)
+ {
+ return LockManager.DEFAULT_FAIR_ORDERING;
+ }
+ else
+ {
+ try
+ {
+ return Boolean.parseBoolean(fairOrderingStr);
+ }
+ catch (Exception e)
+ {
+ return LockManager.DEFAULT_FAIR_ORDERING;
+ }
+ }
+ }
+
+ /**
* Retrieves the initial table size for the server lock table. This
* can be used to ensure that the lock table has the appropriate
* size for the expected number of locks that will be held at any
@@ -1034,22 +1076,22 @@
lockTableSize));
}
- String concurrencyStr =
+ String tableSizeStr =
setProperty(PROPERTY_LOCK_MANAGER_TABLE_SIZE,
String.valueOf(lockTableSize));
- if (concurrencyStr == null)
+ if (tableSizeStr == null)
{
- return LockManager.DEFAULT_CONCURRENCY_LEVEL;
+ return LockManager.DEFAULT_INITIAL_TABLE_SIZE;
}
else
{
try
{
- return Integer.parseInt(concurrencyStr);
+ return Integer.parseInt(tableSizeStr);
}
catch (Exception e)
{
- return LockManager.DEFAULT_CONCURRENCY_LEVEL;
+ return LockManager.DEFAULT_INITIAL_TABLE_SIZE;
}
}
}
--
Gitblit v1.10.0