From f73b655466092169abac34833fb628fce1fcdebe Mon Sep 17 00:00:00 2001
From: jcduff <jcduff@localhost>
Date: Thu, 23 Oct 2008 14:04:24 +0000
Subject: [PATCH] The commit will bring the following features : - An updated version of the underlying database. BDB JE 3.3 is now used. - Attribute API refactoring providing a better abstraction and offering improved performances. - A new GUI called the Control-Panel to replace the Status-Panel: the specifications for this GUI are available on OpenDS Wiki and contains a link to a mockup. See <https://www.opends.org/wiki/page/ControlPanelUISpecification>. - Some changes in the replication protocol to implement "Assured Replication Mode". The specifications are on OpenDS Wiki at <https://www.opends.org/wiki/page/AssuredMode> and section 7 described some of the replication changes required to support this. Assured Replication is not finished, but the main replication protocol changes to support it are done. As explained by Gilles on an email on the Dev mailing list (http://markmail.org/message/46rgo3meq3vriy4a), with these changes the newer versions of OpenDS may not be able to replicate with OpenDS 1.0 instances. - Support for Service Tags on the platforms where the functionality is available and enabled. Specifications are published at <https://www.opends.org/wiki/page/OpenDSServiceTagEnabled>. For more information on Service Tags see <http://wikis.sun.com/display/ServiceTag/Sun+Service+Tag+FAQ>. - The Admin Connector service. In order to provide agentry of the OpenDS server at any time, a new service has been added, dedicated to the administration, configuration and monitoring of the server. An overview of the Admin Connector service and it's use is available on the OpenDS wiki <https://www.opends.org/wiki/page/ManagingAdministrationTrafficToTheServer> - Updates to the various command line tools to support the Admin Connector service. - Some internal re-architecting of the server to put the foundation of future developments such as virtual directory services. The new NetworkGroups and WorkFlow internal services which have been specified in <https://www.opends.org/wiki/page/BasicOperationRoutingThroughNetworkGroup> are now implemented. - Many bug fixes...
---
opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java | 95 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 90 insertions(+), 5 deletions(-)
diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
index 68ef206..080ab42 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
@@ -65,6 +65,8 @@
import org.opends.server.config.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.PluginConfigManager;
+import org.opends.server.core.QueueingStrategy;
+import org.opends.server.core.WorkQueueStrategy;
import org.opends.server.extensions.NullConnectionSecurityProvider;
import org.opends.server.extensions.TLSConnectionSecurityProvider;
import org.opends.server.types.AddressMask;
@@ -109,6 +111,11 @@
private static final String CLASS_NAME =
"org.opends.server.protocols.ldap.LDAPConnectionHandler";
+ /**
+ * Default friendly name for the LDAP connection handler.
+ */
+ private static final String DEFAULT_FRIENDLY_NAME = "LDAP Connection Handler";
+
// The current configuration state.
private LDAPConnectionHandlerCfg currentConfig;
@@ -185,21 +192,49 @@
// new client connections.
private ConnectionSecurityProvider securityProvider;
+// Queueing strategy
+ private final QueueingStrategy queueingStrategy;
+ // The condition variable that will be used by the start method
+ // to wait for the socket port to be opened and ready to process
+ // requests before returning.
+ private Object waitListen = new Object();
+
+ // The friendly name of this connection handler.
+ private String friendlyName;
/**
* Creates a new instance of this LDAP connection handler. It must
* be initialized before it may be used.
*/
public LDAPConnectionHandler() {
- super("LDAP Connection Handler Thread");
+ this(new WorkQueueStrategy(), DEFAULT_FRIENDLY_NAME);
+ }
+
+
+ /**
+ * Creates a new instance of this LDAP connection handler, using a queueing
+ * strategy. It must be initialized before it may be used.
+ * @param strategy Request handling strategy.
+ * @param friendlyName Friendly name to use in this connector.
+ * If null, the default one is used.
+ */
+ public LDAPConnectionHandler(QueueingStrategy strategy, String friendlyName) {
+ super(DEFAULT_FRIENDLY_NAME + " Thread");
+
+ if (friendlyName == null) {
+ this.friendlyName = DEFAULT_FRIENDLY_NAME;
+ } else {
+ this.friendlyName = friendlyName;
+ }
+
+ this.queueingStrategy = strategy;
// No real implementation is required. Do all the work in the
// initializeConnectionHandler method.
}
-
/**
* Indicates whether this connection handler should allow
* interaction with LDAPv2 clients.
@@ -683,7 +718,7 @@
// set of listeners.
listeners = new LinkedList<HostPort>();
StringBuilder nameBuffer = new StringBuilder();
- nameBuffer.append("LDAP Connection Handler");
+ nameBuffer.append(friendlyName);
for (InetAddress a : listenAddresses) {
listeners.add(new HostPort(a.getHostAddress(), listenPort));
nameBuffer.append(" ");
@@ -724,6 +759,10 @@
}
}
+ // Create a system property to store the LDAP(S) port the server is
+ // listening to. This information can be displayed with jinfo.
+ System.setProperty(protocol + "_port", String.valueOf(listenPort));
+
// Create and start the request handlers.
requestHandlers = new LDAPRequestHandler[numRequestHandlers];
for (int i = 0; i < numRequestHandlers; i++) {
@@ -831,6 +870,32 @@
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void start()
+ {
+ // The Directory Server start process should only return
+ // when the connection handlers port are fully opened
+ // and working. The start method therefore needs to wait for
+ // the created thread to
+ synchronized (waitListen)
+ {
+ super.start();
+
+ try
+ {
+ waitListen.wait();
+ } catch (InterruptedException e) {
+ // If something interrupted the start its probably better
+ // to return ASAP.
+ }
+ }
+ }
+
+
/**
* Operates in a loop, accepting new connections and ensuring that
* requests on those connections are handled properly.
@@ -847,7 +912,7 @@
cleanUpSelector();
listening = false;
- logError(ERR_LDAP_CONNHANDLER_STOPPED_LISTENING.get(handlerName));
+ logError(NOTE_LDAP_CONNHANDLER_STOPPED_LISTENING.get(handlerName));
}
try {
@@ -876,7 +941,7 @@
channel.register(selector, SelectionKey.OP_ACCEPT);
numRegistered++;
- logError(ERR_LDAP_CONNHANDLER_STARTED_LISTENING.get(handlerName));
+ logError(NOTE_LDAP_CONNHANDLER_STARTED_LISTENING.get(handlerName));
} catch (Exception e) {
if (debugEnabled())
{
@@ -889,6 +954,14 @@
}
}
+ // At this point, the connection Handler either started
+ // correctly or failed to start but the start process
+ // should be notified and resume its work in any cases.
+ synchronized(waitListen)
+ {
+ waitListen.notify();
+ }
+
// If none of the listeners were created successfully, then
// consider the connection handler disabled and require
// administrative action before trying again.
@@ -1191,4 +1264,16 @@
}
}
}
+
+
+
+ /**
+ * Get the queueing strategy.
+ *
+ * @return The queueing strategy.
+ */
+ public QueueingStrategy getQueueingStrategy() {
+ return queueingStrategy;
+ }
+
}
--
Gitblit v1.10.0