@ThreadSafety(level=MOSTLY_NOT_THREADSAFE) public final class RetainConnectExceptionReferralConnector extends java.lang.Object implements ReferralConnector
getExceptionFromLastConnectAttempt()
method may return the result
from the last attempt made on another thread. It is therefore recommended
that this connector only be used in contexts where it can be safely assumed
that it will not be used concurrently across multiple threads. For example,
if a connection is not expected to be concurrently shared by multiple
threads, then it may be desirable to use the
LDAPConnection.setReferralConnector(ReferralConnector)
to set a
different instance of this connector for each connection. Alternately, the
LDAPRequest.setReferralConnector(ReferralConnector)
method may be
used to specify a connector that should be used for an individual request.Constructor and Description |
---|
RetainConnectExceptionReferralConnector()
Creates a new instance of this referral connector that will use the
connection's default referral handler to actually attempt to establish a
connection.
|
RetainConnectExceptionReferralConnector(ReferralConnector wrappedReferralConnector)
Creates a new instance of this referral connector that will use the
provided connector to actually attempt to establish a connection.
|
Modifier and Type | Method and Description |
---|---|
LDAPException |
getExceptionFromLastConnectAttempt()
Retrieves the exception that was caught in the last attempt to establish a
connection for the purpose of following a referral, if any.
|
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.
|
public RetainConnectExceptionReferralConnector()
public RetainConnectExceptionReferralConnector(@Nullable ReferralConnector wrappedReferralConnector)
wrappedReferralConnector
- The referral connector that will be used
to actually attempt to establish a
connection for the purpose of following a
referral. This may be null
to
use the default referral connector for
the connection on which the referral was
received.@Nullable public LDAPException getExceptionFromLastConnectAttempt()
null
if the last connection attempt was successful or if
there have not yet been any connection attempts.@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.