From 9d6f5c9a5b7771e595892e6935cf1cc42012c4c6 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Tue, 22 Dec 2009 21:37:36 +0000
Subject: [PATCH] Fixed some bugs with the connection pool.  Moved heart beat back to heart beat connection factory from isValid method.

---
 sdk/src/org/opends/sdk/AbstractLoadBalancingAlgorithm.java |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/sdk/src/org/opends/sdk/AbstractLoadBalancingAlgorithm.java b/sdk/src/org/opends/sdk/AbstractLoadBalancingAlgorithm.java
index d5676dd..c903cc2 100644
--- a/sdk/src/org/opends/sdk/AbstractLoadBalancingAlgorithm.java
+++ b/sdk/src/org/opends/sdk/AbstractLoadBalancingAlgorithm.java
@@ -1,9 +1,11 @@
 package org.opends.sdk;
 
 import com.sun.opends.sdk.util.Validator;
+import com.sun.opends.sdk.util.StaticUtils;
 
 import java.util.List;
 import java.util.ArrayList;
+import java.util.logging.Level;
 
 /**
  * Created by IntelliJ IDEA. User: digitalperk Date: Dec 15, 2009 Time: 3:49:17
@@ -70,6 +72,15 @@
           {
             resultHandler.handleErrorResult(error);
           }
+          if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING))
+          {
+            StaticUtils.DEBUG_LOG
+                .warning(String
+                    .format(
+                    "Connection factory " + factory +
+                        " is no longer operational: "
+                        + error.getMessage()));
+          }
         }
 
         public void handleResult(AsynchronousConnection result)
@@ -79,6 +90,14 @@
           {
             resultHandler.handleResult(result);
           }
+          if (StaticUtils.DEBUG_LOG.isLoggable(Level.WARNING))
+          {
+            StaticUtils.DEBUG_LOG
+                .warning(String
+                    .format(
+                    "Connection factory " + factory +
+                        " is now operational"));
+          }
         }
       };
       return factory.getAsynchronousConnection(handler);
@@ -100,8 +119,13 @@
         for(MonitoredConnectionFactory f : factoryList)
         {
           if(!f.isOperational && (f.pendingConnectFuture == null ||
-                                  f.pendingConnectFuture.isDone()))
+              f.pendingConnectFuture.isDone()))
           {
+            if (StaticUtils.DEBUG_LOG.isLoggable(Level.FINEST))
+            {
+              StaticUtils.DEBUG_LOG
+                  .finest(String.format("Attempting connect on factory " + f));
+            }
             f.pendingConnectFuture = f.factory.getAsynchronousConnection(f);
           }
         }

--
Gitblit v1.10.0