From f0832f34a0f104f1f0fbf72d9d993a47d67b8ff5 Mon Sep 17 00:00:00 2001
From: Mark Craig <mark.craig@forgerock.com>
Date: Wed, 10 Apr 2013 14:40:15 +0000
Subject: [PATCH] CR-1532 Fix for OPENDJ-850: Dev guide section on load balancing and failover could be more complete

---
 opendj-sdk/opendj3/src/main/docbkx/dev-guide/chap-simple-proxy.xml |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opendj3/src/main/docbkx/dev-guide/chap-simple-proxy.xml b/opendj-sdk/opendj3/src/main/docbkx/dev-guide/chap-simple-proxy.xml
index 1056959..7dd0388 100644
--- a/opendj-sdk/opendj3/src/main/docbkx/dev-guide/chap-simple-proxy.xml
+++ b/opendj-sdk/opendj3/src/main/docbkx/dev-guide/chap-simple-proxy.xml
@@ -20,7 +20,7 @@
   !
   ! CCPL HEADER END
   !
-  !      Copyright 2011-2012 ForgeRock AS
+  !      Copyright 2011-2013 ForgeRock AS
   !    
 -->
 <chapter xml:id='chap-simple-proxy'
@@ -122,12 +122,41 @@
   of connection factories, such as those that you set up for connection
   pooling.</para>
 
+  <para>The following excerpt shows how to set up round robin load balancing
+  across directory servers.</para>
+
   <programlisting language="java"
->final RoundRobinLoadBalancingAlgorithm algorithm =
+  >final List&lt;ConnectionFactory&gt; factories = new LinkedList&lt;ConnectionFactory&gt;();
+
+// Set up a ConnectionFactory for each directory server in the pool as shown in
+// the previous example, and then set up a load balancer.
+
+final RoundRobinLoadBalancingAlgorithm algorithm =
         new RoundRobinLoadBalancingAlgorithm(factories);
 
 final ConnectionFactory factory = Connections.newLoadBalancer(algorithm);</programlisting>
 
+  <para>With multiple pools of directory servers, for example in a deployment
+  across multiple data centers, also use fail over load balancing. Fail over
+  load balancing directs all requests to the first (preferred) pool of servers
+  until problems are encountered with the connections to that pool. Then it
+  fails over to the next pool in the list. Therefore in each data center you
+  can set up round robin load balancing, and then set up fail over load
+  balancing across data centers.</para>
+
+  <programlisting language="java"
+  >// localFactory:  ConnectionFactory to servers in the local data center
+// remoteFactory: ConnectionFactory for servers in a remote data center
+// localFactory and remoteFactory use round robin load balancing "internally".
+
+final List&lt;ConnectionFactory&gt; factories =
+        Arrays.asList(localFactory, remoteFactory);
+
+final FailoverLoadBalancingAlgorithm algorithm =
+        new FailoverLoadBalancingAlgorithm(factories);
+
+final ConnectionFactory factory = Connections.newLoadBalancer(algorithm);</programlisting>
+
   <para>The algorithms also include constructors that let you adjust timeouts
   and so forth.</para>
  </section>

--
Gitblit v1.10.0