Package com.unboundid.ldap.sdk
Interface LDAPConnectionInfo
- All Known Implementing Classes:
LDAPConnection
This interface defines a number of methods that may be used to obtain
information about an LDAP connection. This should be treated as a
read-only interface, and when a connection is used in the context of this
interface, no processing should be performed that would alter any state.
-
Method Summary
Modifier and TypeMethodDescriptionintRetrieves the number of outstanding operations on this LDAP connection (i.e., the number of operations currently in progress).Retrieves the address of the directory server to which this connection is currently established.Retrieves anInetAddressobject that represents the address of the server to which this connection is currently established.Retrieves the string representation of the IP address to which this connection is currently established.intRetrieves the port of the directory server to which this connection is currently established.longRetrieves a value that uniquely identifies this connection within the JVM EachLDAPConnectionobject will be assigned a different connection ID, and that connection ID will not change over the life of the object, even if the connection is closed and re-established (whether re-established to the same server or a different server).Retrieves the user-friendly name that has been assigned to this connection.Retrieves the user-friendly name that has been assigned to the connection pool with which this connection is associated.Retrieves the connection statistics for this LDAP connection.Retrieves a stack trace of the thread that last attempted to establish this connection.longRetrieves the time that this connection was established in the number of milliseconds since January 1, 1970 UTC (the same format used bySystem.currentTimeMillis.Retrieves the disconnect cause for this connection, which is an exception or error that triggered the connection termination, if available.Retrieves the disconnect message for this connection, which may provide additional information about the reason for the disconnect, if available.Retrieves the disconnect type for this connection, if available.Retrieves a string representation of the host and port for the server to to which the last connection attempt was made.Retrieves the last successful bind request processed on this connection.longRetrieves the time that this connection was last used to send or receive an LDAP message.Retrieves the socket factory that was used when creating the socket for the last connection attempt (whether successful or unsuccessful) for this LDAP connection.Retrieves the socket factory to use to create the socket for subsequent connection attempts.Retrieves theSSLSessioncurrently being used to secure communication on this connection.Retrieves the StartTLS request used to secure this connection.booleanIndicates whether this connection is currently established.booleanIndicates whether this connection is operating in synchronous mode.toString()Retrieves a string representation of this LDAP connection.voidtoString(StringBuilder buffer) Appends a string representation of this LDAP connection to the provided buffer.
-
Method Details
-
isConnected
boolean isConnected()Indicates whether this connection is currently established.- Returns:
trueif this connection is currently established, orfalseif it is not.
-
getLastUsedSocketFactory
Retrieves the socket factory that was used when creating the socket for the last connection attempt (whether successful or unsuccessful) for this LDAP connection.- Returns:
- The socket factory that was used when creating the socket for the
last connection attempt for this LDAP connection, or
nullif no attempt has yet been made to establish this connection.
-
getSocketFactory
Retrieves the socket factory to use to create the socket for subsequent connection attempts. This may or may not be the socket factory that was used to create the current established connection.- Returns:
- The socket factory to use to create the socket for subsequent connection attempts.
-
getSSLSession
Retrieves theSSLSessioncurrently being used to secure communication on this connection. This may be available for connections that were secured at the time they were created (via anSSLSocketFactory), or for connections secured after their creation (via the StartTLS extended operation). This will not be available for unencrypted connections, or connections secured in other ways (e.g., via SASL QoP).- Returns:
- The
SSLSessioncurrently being used to secure communication on this connection, ornullif noSSLSessionis available.
-
getConnectionID
long getConnectionID()Retrieves a value that uniquely identifies this connection within the JVM EachLDAPConnectionobject will be assigned a different connection ID, and that connection ID will not change over the life of the object, even if the connection is closed and re-established (whether re-established to the same server or a different server).- Returns:
- A value that uniquely identifies this connection within the JVM.
-
getConnectionName
Retrieves the user-friendly name that has been assigned to this connection.- Returns:
- The user-friendly name that has been assigned to this connection,
or
nullif none has been assigned.
-
getConnectionPoolName
Retrieves the user-friendly name that has been assigned to the connection pool with which this connection is associated.- Returns:
- The user-friendly name that has been assigned to the connection
pool with which this connection is associated, or
nullif none has been assigned or this connection is not associated with a connection pool.
-
getHostPort
Retrieves a string representation of the host and port for the server to to which the last connection attempt was made. It does not matter whether the connection attempt was successful, nor does it matter whether it is still established. This is primarily intended for internal use in error messages.- Returns:
- A string representation of the host and port for the server to which the last connection attempt was made, or an empty string if no connection attempt has yet been made on this connection.
-
getConnectedAddress
Retrieves the address of the directory server to which this connection is currently established.- Returns:
- The address of the directory server to which this connection is
currently established, or
nullif the connection is not established.
-
getConnectedIPAddress
Retrieves the string representation of the IP address to which this connection is currently established.- Returns:
- The string representation of the IP address to which this
connection is currently established, or
nullif the connection is not established.
-
getConnectedInetAddress
Retrieves anInetAddressobject that represents the address of the server to which this connection is currently established.- Returns:
- An
InetAddressthat represents the address of the server to which this connection is currently established, ornullif the connection is not established.
-
getConnectedPort
int getConnectedPort()Retrieves the port of the directory server to which this connection is currently established.- Returns:
- The port of the directory server to which this connection is currently established, or -1 if the connection is not established.
-
getConnectStackTrace
Retrieves a stack trace of the thread that last attempted to establish this connection. Note that this will only be available if an attempt has been made to establish this connection and theLDAPConnectionOptions.captureConnectStackTrace()method for the associated connection options returnstrue.- Returns:
- A stack trace of the thread that last attempted to establish this
connection, or
nullconnect stack traces are not enabled, or if no attempt has been made to establish this connection.
-
getDisconnectType
Retrieves the disconnect type for this connection, if available.- Returns:
- The disconnect type for this connection, or
nullif no disconnect type has been set.
-
getDisconnectMessage
Retrieves the disconnect message for this connection, which may provide additional information about the reason for the disconnect, if available.- Returns:
- The disconnect message for this connection, or
nullif no disconnect message has been set.
-
getDisconnectCause
Retrieves the disconnect cause for this connection, which is an exception or error that triggered the connection termination, if available.- Returns:
- The disconnect cause for this connection, or
nullif no disconnect cause has been set.
-
getLastBindRequest
Retrieves the last successful bind request processed on this connection.- Returns:
- The last successful bind request processed on this connection. It
may be
nullif no bind has been performed, or if the last bind attempt was not successful.
-
getStartTLSRequest
Retrieves the StartTLS request used to secure this connection.- Returns:
- The StartTLS request used to secure this connection, or
nullif StartTLS has not been used to secure this connection.
-
synchronousMode
boolean synchronousMode()Indicates whether this connection is operating in synchronous mode.- Returns:
trueif this connection is operating in synchronous mode, orfalseif not.
-
getConnectTime
long getConnectTime()Retrieves the time that this connection was established in the number of milliseconds since January 1, 1970 UTC (the same format used bySystem.currentTimeMillis.- Returns:
- The time that this connection was established, or -1 if the connection is not currently established.
-
getLastCommunicationTime
long getLastCommunicationTime()Retrieves the time that this connection was last used to send or receive an LDAP message. The value will represent the number of milliseconds since January 1, 1970 UTC (the same format used bySystem.currentTimeMillis.- Returns:
- The time that this connection was last used to send or receive an
LDAP message. If the connection is not established, then -1 will
be returned. If the connection is established but no
communication has been performed over the connection since it was
established, then the value of
getConnectTime()will be returned.
-
getConnectionStatistics
Retrieves the connection statistics for this LDAP connection.- Returns:
- The connection statistics for this LDAP connection.
-
getActiveOperationCount
int getActiveOperationCount()Retrieves the number of outstanding operations on this LDAP connection (i.e., the number of operations currently in progress). The value will only be valid for connections not configured to use synchronous mode.- Returns:
- The number of outstanding operations on this LDAP connection, or -1 if it cannot be determined (e.g., because the connection is not established or is operating in synchronous mode).
-
toString
Retrieves a string representation of this LDAP connection. -
toString
Appends a string representation of this LDAP connection to the provided buffer.- Parameters:
buffer- The buffer to which to append a string representation of this LDAP connection.
-