Package com.mongodb.event
Class ConnectionCheckedOutEvent
java.lang.Object
com.mongodb.event.ConnectionCheckedOutEvent
An event for checking out a connection from the pool.
Such a connection is considered in use until it becomes available.
- Since:
- 3.5
-
Constructor Summary
ConstructorsConstructorDescriptionConnectionCheckedOutEvent(ConnectionId connectionId, long operationId, long elapsedTimeNanos) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the connection idlonggetElapsedTime(TimeUnit timeUnit) The time it took to check out the connection.longGets the operation identifiertoString()
-
Constructor Details
-
ConnectionCheckedOutEvent
public ConnectionCheckedOutEvent(ConnectionId connectionId, long operationId, long elapsedTimeNanos) Constructs an instance.- Parameters:
connectionId- The connection ID. SeegetConnectionId().operationId- The operation ID. SeegetOperationId().elapsedTimeNanos- The time it took to check out the connection. SeegetElapsedTime(TimeUnit).- Since:
- 4.11
-
-
Method Details
-
getConnectionId
Gets the connection id- Returns:
- the connection id
-
getOperationId
public long getOperationId()Gets the operation identifier- Returns:
- the operation identifier
- Since:
- 4.10
-
getElapsedTime
The time it took to check out the connection. More specifically, the time elapsed between emitting aConnectionCheckOutStartedEventand 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 totimeUnitis done.- Returns:
- The time it took to establish the connection.
- Since:
- 4.11
-
toString
-