env.put(Context.PROVIDER_URL, "ldap://server1:389/ ldap://server2:389/");
env.put("com.sun.jndi.ldap.connect.pool", "true");
 
  Testing scenarios:
 
Stage #1:   primary server(1) is up    +  sencondary server(2) is up
Stage #2:   primary server(1) is down  +  sencondary server(2) is up
Stage #3:   primary server(1) is up    +  sencondary server(2) is up
  Test results are the same as without pooling:
 
Stage #1:   client connection goes to the primary server(1)
Stage #2:   client connection goes to the secondary server(2)
Stage #3:   client connection goes back to the primary server(1) again.
 
  |