From 69d79ba4758a30644f94a383d2227fd77e64285f Mon Sep 17 00:00:00 2001 From: Neil Wilson Date: Wed, 2 Aug 2023 18:16:28 -0500 Subject: [PATCH] Add a PooledReferralConnector Javadoc example --- .../ldap/sdk/PooledReferralConnector.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/com/unboundid/ldap/sdk/PooledReferralConnector.java b/src/com/unboundid/ldap/sdk/PooledReferralConnector.java index 71aeb682f..a58ac2b6f 100644 --- a/src/com/unboundid/ldap/sdk/PooledReferralConnector.java +++ b/src/com/unboundid/ldap/sdk/PooledReferralConnector.java @@ -61,7 +61,36 @@ * This class provides an implementation of a reusable referral connector that * maintains pools of connections to each of the servers accessed in the course * of following referrals. Connections may be reused across multiple - * referrals. + * referrals. Note that it is important to close the connector when it is no + * longer needed, as that will ensure that all of the connection pools that it + * maintains will be closed. + *

+ *

Example

+ * The following example demonstrates the process for establishing an LDAP + * connection that will use this connector for following any referrals that are + * encountered during processing: + *
+ *   PooledReferralConnectorProperties properties =
+ *        new PooledReferralConnectorProperties();
+ *
+ *   PooledReferralConnector referralConnector =
+ *        new PooledReferralConnector(properties);
+ *
+ *   LDAPConnectionOptions options = new LDAPConnectionOptions();
+ *   options.setFollowReferrals(true);
+ *   options.setReferralConnector(referralConnector);
+ *
+ *   try (LDAPConnection conn = new LDAPConnection(socketFactory, options,
+ *             serverAddress, serverPort)
+ *   {
+ *     // Use the connection to perform whatever processing is needed that might
+ *     // involve receiving referrals.
+ *   }
+ *   finally
+ *   {
+ *     referralConnector.close();
+ *   }
+ * 
*/ @NotMutable() @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)