Package com.unboundid.ldap.sdk
Interface DisconnectHandler
-
@Extensible @ThreadSafety(level=INTERFACE_THREADSAFE) public interface DisconnectHandler
This interface defines an API that may be implemented by a class that should be notified whenever an LDAP connection is closed for any reason. (whether the connection was closed at the request of the client via a method likeLDAPConnection.close()
, terminated by the server, or closed due to an internal error). This interface may be used by applications to attempt to automatically re-establish connections as soon as they are terminated, potentially falling over to another server.
It is acceptable to attempt to re-connect the connection that has been disconnected, but in general that should only be attempted ifDisconnectType.isExpected(DisconnectType)
returnstrue
for the provideddisconnectType
value. The disconnect handler will be temporarily de-registered from the connection so that closing the connection in the course of processing thehandleDisconnect(com.unboundid.ldap.sdk.LDAPConnection, java.lang.String, int, com.unboundid.ldap.sdk.DisconnectType, java.lang.String, java.lang.Throwable)
method will not cause it to be recursively re-invoked.
Implementations of this interface should be threadsafe to ensure that multiple connections will be able to safely use the sameDisconnectHandler
instance.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
handleDisconnect(LDAPConnection connection, java.lang.String host, int port, DisconnectType disconnectType, java.lang.String message, java.lang.Throwable cause)
Performs any processing that may be necessary in response to the closure of the provided connection.
-
-
-
Method Detail
-
handleDisconnect
void handleDisconnect(LDAPConnection connection, java.lang.String host, int port, DisconnectType disconnectType, java.lang.String message, java.lang.Throwable cause)
Performs any processing that may be necessary in response to the closure of the provided connection.- Parameters:
connection
- The connection that has been closed.host
- The address of the server to which the connection had been established.port
- The port of the server to which the connection had been established.disconnectType
- The disconnect type, which provides general information about the nature of the disconnect.message
- A message that may be associated with the disconnect. It may benull
if no message is available.cause
- AThrowable
that was caught and triggered the disconnect. It may benull
if the disconnect was not triggered by a client-side exception or error.
-
-