Class ConnectionCheckOutFailedEvent

java.lang.Object
com.mongodb.event.ConnectionCheckOutFailedEvent

public final class ConnectionCheckOutFailedEvent extends Object
An event for when checking out a connection fails.
Since:
4.0
  • Constructor Details

  • Method Details

    • getServerId

      public ServerId getServerId()
      Gets the server id
      Returns:
      the server id
    • getOperationId

      public long getOperationId()
      Gets the operation identifier
      Returns:
      the operation identifier
      Since:
      4.10
    • getReason

      Gets the reason for the check out failure.
      Returns:
      the reason
      Since:
      4.3
    • getElapsedTime

      public long getElapsedTime(TimeUnit timeUnit)
      The time it took to check out the connection. More specifically, the time elapsed between emitting a ConnectionCheckOutStartedEvent and emitting this event as part of the same checking out.

      Naturally, if a new connection was not created and established as part of checking out, this duration is usually not greater than ConnectionPoolSettings.getMaxWaitTime(TimeUnit), but may occasionally be greater than that, because the driver does not provide hard real-time guarantees.

      Parameters:
      timeUnit - The time unit of the result. TimeUnit.convert(long, TimeUnit) specifies how the conversion from nanoseconds to timeUnit is done.
      Returns:
      The time it took to establish the connection.
      Since:
      4.11
    • toString

      public String toString()
      Overrides:
      toString in class Object