Package com.unboundid.ldap.sdk
Interface LDAPConnectionInfo
-
- All Known Implementing Classes:
LDAPConnection
@NotExtensible @ThreadSafety(level=COMPLETELY_THREADSAFE) public interface LDAPConnectionInfo
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getActiveOperationCount()
Retrieves the number of outstanding operations on this LDAP connection (i.e., the number of operations currently in progress).java.lang.String
getConnectedAddress()
Retrieves the address of the directory server to which this connection is currently established.java.net.InetAddress
getConnectedInetAddress()
Retrieves anInetAddress
object that represents the address of the server to which this connection is currently established.java.lang.String
getConnectedIPAddress()
Retrieves the string representation of the IP address to which this connection is currently established.int
getConnectedPort()
Retrieves the port of the directory server to which this connection is currently established.long
getConnectionID()
Retrieves a value that uniquely identifies this connection within the JVM EachLDAPConnection
object 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).java.lang.String
getConnectionName()
Retrieves the user-friendly name that has been assigned to this connection.java.lang.String
getConnectionPoolName()
Retrieves the user-friendly name that has been assigned to the connection pool with which this connection is associated.LDAPConnectionStatistics
getConnectionStatistics()
Retrieves the connection statistics for this LDAP connection.java.lang.StackTraceElement[]
getConnectStackTrace()
Retrieves a stack trace of the thread that last attempted to establish this connection.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
.java.lang.Throwable
getDisconnectCause()
Retrieves the disconnect cause for this connection, which is an exception or error that triggered the connection termination, if available.java.lang.String
getDisconnectMessage()
Retrieves the disconnect message for this connection, which may provide additional information about the reason for the disconnect, if available.DisconnectType
getDisconnectType()
Retrieves the disconnect type for this connection, if available.java.lang.String
getHostPort()
Retrieves a string representation of the host and port for the server to to which the last connection attempt was made.BindRequest
getLastBindRequest()
Retrieves the last successful bind request processed on this connection.long
getLastCommunicationTime()
Retrieves the time that this connection was last used to send or receive an LDAP message.javax.net.SocketFactory
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.javax.net.SocketFactory
getSocketFactory()
Retrieves the socket factory to use to create the socket for subsequent connection attempts.javax.net.ssl.SSLSession
getSSLSession()
Retrieves theSSLSession
currently being used to secure communication on this connection.ExtendedRequest
getStartTLSRequest()
Retrieves the StartTLS request used to secure this connection.boolean
isConnected()
Indicates whether this connection is currently established.boolean
synchronousMode()
Indicates whether this connection is operating in synchronous mode.java.lang.String
toString()
Retrieves a string representation of this LDAP connection.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP connection to the provided buffer.
-
-
-
Method Detail
-
isConnected
boolean isConnected()
Indicates whether this connection is currently established.- Returns:
true
if this connection is currently established, orfalse
if it is not.
-
getLastUsedSocketFactory
javax.net.SocketFactory 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
null
if no attempt has yet been made to establish this connection.
-
getSocketFactory
javax.net.SocketFactory 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
javax.net.ssl.SSLSession getSSLSession()
Retrieves theSSLSession
currently 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
SSLSession
currently being used to secure communication on this connection, ornull
if noSSLSession
is available.
-
getConnectionID
long getConnectionID()
Retrieves a value that uniquely identifies this connection within the JVM EachLDAPConnection
object 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
java.lang.String 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
null
if none has been assigned.
-
getConnectionPoolName
java.lang.String 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
null
if none has been assigned or this connection is not associated with a connection pool.
-
getHostPort
java.lang.String 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
java.lang.String 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
null
if the connection is not established.
-
getConnectedIPAddress
java.lang.String 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
null
if the connection is not established.
-
getConnectedInetAddress
java.net.InetAddress getConnectedInetAddress()
Retrieves anInetAddress
object that represents the address of the server to which this connection is currently established.- Returns:
- An
InetAddress
that represents the address of the server to which this connection is currently established, ornull
if 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
java.lang.StackTraceElement[] 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
null
connect stack traces are not enabled, or if no attempt has been made to establish this connection.
-
getDisconnectType
DisconnectType getDisconnectType()
Retrieves the disconnect type for this connection, if available.- Returns:
- The disconnect type for this connection, or
null
if no disconnect type has been set.
-
getDisconnectMessage
java.lang.String 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
null
if no disconnect message has been set.
-
getDisconnectCause
java.lang.Throwable 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
null
if no disconnect cause has been set.
-
getLastBindRequest
BindRequest getLastBindRequest()
Retrieves the last successful bind request processed on this connection.- Returns:
- The last successful bind request processed on this connection. It
may be
null
if no bind has been performed, or if the last bind attempt was not successful.
-
getStartTLSRequest
ExtendedRequest getStartTLSRequest()
Retrieves the StartTLS request used to secure this connection.- Returns:
- The StartTLS request used to secure this connection, or
null
if StartTLS has not been used to secure this connection.
-
synchronousMode
boolean synchronousMode()
Indicates whether this connection is operating in synchronous mode.- Returns:
true
if this connection is operating in synchronous mode, orfalse
if 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
LDAPConnectionStatistics 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
java.lang.String toString()
Retrieves a string representation of this LDAP connection.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this LDAP connection.
-
toString
void toString(java.lang.StringBuilder buffer)
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.
-
-