@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class PooledReferralConnector extends java.lang.Object implements ReusableReferralConnector, java.io.Closeable
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(); }
Constructor and Description |
---|
PooledReferralConnector()
Creates a new pooled referral connector with a default set of properties.
|
PooledReferralConnector(PooledReferralConnectorProperties properties)
Creates a new pooled referral connector with the provided set of
properties.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes and discards all connection pools that are associated with this
connector.
|
BindRequest |
getBindRequest()
Retrieves the bind request that should be used to authenticate pooled
connections, if defined.
|
LDAPConnectionOptions |
getConnectionOptions()
Retrieves the set of options that will be used when establishing new pooled
connections for the purpose of following referrals.
|
LDAPConnectionPoolHealthCheck |
getHealthCheck()
Retrieves the health check that should be used to determine whether pooled
connections are still valid.
|
long |
getHealthCheckIntervalMillis()
Retrieves the length of time in milliseconds between background health
checks performed against pooled connections.
|
int |
getInitialConnectionsPerPool()
Retrieves the initial number of connections to establish when creating a
new connection pool for the purpose of following referrals.
|
PooledReferralConnectorLDAPURLSecurityType |
getLDAPURLSecurityType()
Indicates the type of communication security that the referral connector
should use when creating connections for referral URLs with a scheme of
"ldap".
|
long |
getMaximumConnectionAgeMillis()
Retrieves the maximum length of time in milliseconds that each pooled
connection may remain established.
|
int |
getMaximumConnectionsPerPool()
Retrieves the maximum number of idle connections that the server should
maintain in each connection pool used for following referrals.
|
long |
getMaximumPoolAgeMillis()
Retrieves the maximum length of time in milliseconds that a connection pool
created for the purpose of following referrals should be retained,
regardless of how often it is used.
|
long |
getMaximumPoolIdleDurationMillis()
Retrieves the maximum length of time in milliseconds that a connection pool
created for the purpose of following referrals should be retained after its
most recent use.
|
LDAPConnection |
getReferralConnection(LDAPURL referralURL,
LDAPConnection connection)
Retrieves an (optionally authenticated) LDAP connection for use in
following a referral as defined in the provided LDAP URL.
|
LDAPConnectionPool |
getReferralInterface(LDAPURL referralURL,
LDAPConnection connection)
Retrieves a
FullLDAPInterface for use in following a referral
returned in the provided result. |
javax.net.ssl.SSLSocketFactory |
getSSLSocketFactory()
Retrieves the SSL socket factory that will be used when performing TLS
negotiation on any new connections created for the purpose of following
referrals.
|
boolean |
retryFailedOperationsDueToInvalidConnections()
Indicates whether the connection pools should be configured to
automatically retry an operation on a newly established connection if the
initial attempt fails in a manner that suggests that the connection may no
longer be valid.
|
public PooledReferralConnector()
public PooledReferralConnector(@NotNull PooledReferralConnectorProperties properties)
properties
- The properties to use for the pooled referral
connector. It must not be null
.public int getInitialConnectionsPerPool()
public int getMaximumConnectionsPerPool()
public boolean retryFailedOperationsDueToInvalidConnections()
true
if connection pools should be configured to
automatically retry an operation on a newly established connection
if the initial attempt fails in a manner that suggests the
connection may no longer be valid, or false
if not.public long getMaximumConnectionAgeMillis()
public long getMaximumPoolAgeMillis()
public long getMaximumPoolIdleDurationMillis()
@Nullable public LDAPConnectionPoolHealthCheck getHealthCheck()
null
if no special
health checking should be performed.public long getHealthCheckIntervalMillis()
@Nullable public BindRequest getBindRequest()
null
if pooled connections should be
authenticated with the same bind request that was used to
authenticate the connection on which the referral was received.@Nullable public LDAPConnectionOptions getConnectionOptions()
null
if new connections will use the same set of options
as the connection on which a referral was received.@NotNull public PooledReferralConnectorLDAPURLSecurityType getLDAPURLSecurityType()
PooledReferralConnectorLDAPURLSecurityType
enum for more information. By default, the
CONDITIONALLY_USE_LDAP_AND_CONDITIONALLY_USE_START_TLS
security
type will be used.@Nullable public javax.net.ssl.SSLSocketFactory getSSLSocketFactory()
null
if new pooled connections
will use the same socket factory as the connection on which a
referral was received.public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
@NotNull public LDAPConnectionPool getReferralInterface(@NotNull LDAPURL referralURL, @NotNull LDAPConnection connection) throws LDAPException
FullLDAPInterface
for use in following a referral
returned in the provided result. The caller must not do anything to
attempt to leave the interface in an unusable state (e.g., closing a
connection or connection pool).getReferralInterface
in interface ReusableReferralConnector
referralURL
- The LDAP URL for the referral to follow. It must not
be null
.connection
- The connection on which the referral was received. It
will not be null
.FullLDAPInterface
for use in following a referral with
the given URL.LDAPException
- If a problem occurs while obtaining the
FullLDAPInterface
to use for following the
referral.@NotNull public LDAPConnection getReferralConnection(@NotNull LDAPURL referralURL, @NotNull LDAPConnection connection) throws LDAPException
getReferralConnection
in interface ReferralConnector
referralURL
- The LDAP URL representing the referral being followed.connection
- The connection on which the referral was received.LDAPException
- If a problem occurs while establishing the
connection or performing authentication on it. If
an exception is thrown, then any underlying
connection should be terminated before the
exception is thrown.