From fa6e5bb0c17c4d59d8598979feb1a7701bc32679 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 12 Dec 2006 23:55:39 +0000
Subject: [PATCH] Publish a separate monitor entry for each connection handler, which includes the protocol, listen address/port, number of established connections, and information about each connection.

---
 opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java |   70 +++++++++++++++++++++++++++++++++-
 1 files changed, 67 insertions(+), 3 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 e078e82..adb2099 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
@@ -69,6 +69,7 @@
 import org.opends.server.types.DN;
 import org.opends.server.types.ErrorLogCategory;
 import org.opends.server.types.ErrorLogSeverity;
+import org.opends.server.types.HostPort;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 import org.opends.server.types.SSLClientAuthPolicy;
@@ -206,6 +207,9 @@
   // accepted by the server.
   private int requestHandlerIndex;
 
+  // The set of listeners for this connection handler.
+  private LinkedList<HostPort> listeners;
+
   // The set of request handlers that are associated with this connection
   // handler.
   private LDAPRequestHandler[] requestHandlers;
@@ -223,6 +227,9 @@
   // The unique name assigned to this connection handler.
   private String handlerName;
 
+  // The protocol used by this connection handler.
+  private String protocol;
+
   // The security mechanism used for connections accepted by this connection
   // handler.
   private String securityMechanism;
@@ -996,11 +1003,14 @@
     }
 
 
-    // Construct a unique name for this connection handler.
+    // Construct a unique name for this connection handler, and put together the
+    // set of listeners.
+    listeners = new LinkedList<HostPort>();
     StringBuilder nameBuffer = new StringBuilder();
     nameBuffer.append("LDAP Connection Handler");
     for (InetAddress a : listenAddresses)
     {
+      listeners.add(new HostPort(a.getHostAddress(), listenPort));
       nameBuffer.append(" ");
       nameBuffer.append(a.getHostAddress());
     }
@@ -1013,16 +1023,18 @@
     if (useSSL)
     {
       securityMechanism = SECURITY_MECHANISM_SSL;
+      protocol          = "LDAP+SSL";
     }
     else
     {
       securityMechanism = null;
+      protocol          = "LDAP";
     }
 
 
     // Perform any additional initialization that might be required.
     connHandlerThread = null;
-    statTracker = new LDAPStatistics(handlerName);
+    statTracker = new LDAPStatistics(handlerName + " Statistics");
 
 
     // Create and start the request handlers.
@@ -1091,6 +1103,42 @@
 
 
   /**
+   * {@inheritDoc}
+   */
+  public String getConnectionHandlerName()
+  {
+    assert debugEnter(CLASS_NAME, "getConnectionHandlerName");
+
+    return handlerName;
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getProtocol()
+  {
+    assert debugEnter(CLASS_NAME, "getProtocol");
+
+    return protocol;
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  public Collection<HostPort> getListeners()
+  {
+    assert debugEnter(CLASS_NAME, "getProtocol");
+
+    return listeners;
+  }
+
+
+
+  /**
    * Retrieves the set of active client connections that have been established
    * through this connection handler.
    *
@@ -1114,6 +1162,22 @@
 
 
   /**
+   * Retrieves the port on which this connection handler is listening
+   * for client connections.
+   *
+   * @return  The port on which this connection handler is listening
+   *          for client connections.
+   */
+  public int getListenPort()
+  {
+    assert debugEnter(CLASS_NAME, "getListenPort");
+
+    return listenPort;
+  }
+
+
+
+  /**
    * Operates in a loop, accepting new connections and ensuring that requests on
    * those connections are handled properly.
    */
@@ -3013,7 +3077,7 @@
         {
           if (statTracker == null)
           {
-            statTracker = new LDAPStatistics(handlerName);
+            statTracker = new LDAPStatistics(handlerName + " Statistics");
           }
           else
           {

--
Gitblit v1.10.0