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 intgetActiveOperationCount()Retrieves the number of outstanding operations on this LDAP connection (i.e., the number of operations currently in progress).java.lang.StringgetConnectedAddress()Retrieves the address of the directory server to which this connection is currently established.java.net.InetAddressgetConnectedInetAddress()Retrieves anInetAddressobject that represents the address of the server to which this connection is currently established.java.lang.StringgetConnectedIPAddress()Retrieves the string representation of the IP address to which this connection is currently established.intgetConnectedPort()Retrieves the port of the directory server to which this connection is currently established.longgetConnectionID()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).java.lang.StringgetConnectionName()Retrieves the user-friendly name that has been assigned to this connection.java.lang.StringgetConnectionPoolName()Retrieves the user-friendly name that has been assigned to the connection pool with which this connection is associated.LDAPConnectionStatisticsgetConnectionStatistics()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.longgetConnectTime()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.ThrowablegetDisconnectCause()Retrieves the disconnect cause for this connection, which is an exception or error that triggered the connection termination, if available.java.lang.StringgetDisconnectMessage()Retrieves the disconnect message for this connection, which may provide additional information about the reason for the disconnect, if available.DisconnectTypegetDisconnectType()Retrieves the disconnect type for this connection, if available.java.lang.StringgetHostPort()Retrieves a string representation of the host and port for the server to to which the last connection attempt was made.BindRequestgetLastBindRequest()Retrieves the last successful bind request processed on this connection.longgetLastCommunicationTime()Retrieves the time that this connection was last used to send or receive an LDAP message.javax.net.SocketFactorygetLastUsedSocketFactory()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.SocketFactorygetSocketFactory()Retrieves the socket factory to use to create the socket for subsequent connection attempts.javax.net.ssl.SSLSessiongetSSLSession()Retrieves theSSLSessioncurrently being used to secure communication on this connection.ExtendedRequestgetStartTLSRequest()Retrieves the StartTLS request used to secure this connection.booleanisConnected()Indicates whether this connection is currently established.booleansynchronousMode()Indicates whether this connection is operating in synchronous mode.java.lang.StringtoString()Retrieves a string representation of this LDAP connection.voidtoString(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:
trueif this connection is currently established, orfalseif it is not.
-
getLastUsedSocketFactory
@Nullable 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
nullif no attempt has yet been made to establish this connection.
-
getSocketFactory
@NotNull 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
@Nullable javax.net.ssl.SSLSession 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
@Nullable 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
nullif none has been assigned.
-
getConnectionPoolName
@Nullable 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
nullif none has been assigned or this connection is not associated with a connection pool.
-
getHostPort
@NotNull 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
@Nullable 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
nullif the connection is not established.
-
getConnectedIPAddress
@Nullable 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
nullif the connection is not established.
-
getConnectedInetAddress
@Nullable java.net.InetAddress 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
@Nullable 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
nullconnect stack traces are not enabled, or if no attempt has been made to establish this connection.
-
getDisconnectType
@Nullable DisconnectType 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
@Nullable 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
nullif no disconnect message has been set.
-
getDisconnectCause
@Nullable 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
nullif no disconnect cause has been set.
-
getLastBindRequest
@Nullable 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
nullif no bind has been performed, or if the last bind attempt was not successful.
-
getStartTLSRequest
@Nullable ExtendedRequest 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
@NotNull 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
@NotNull java.lang.String toString()
Retrieves a string representation of this LDAP connection.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of this LDAP connection.
-
-